@@ -1134,10 +1134,7 @@ pub enum Region {
11341134 // Region bound in a type or fn declaration which will be
11351135 // substituted 'early' -- that is, at the same time when type
11361136 // parameters are substituted.
1137- ReEarlyBound ( /* param id */ ast:: NodeId ,
1138- subst:: ParamSpace ,
1139- /*index*/ u32 ,
1140- ast:: Name ) ,
1137+ ReEarlyBound ( EarlyBoundRegion ) ,
11411138
11421139 // Region bound in a function scope, which will be substituted when the
11431140 // function is called.
@@ -1169,6 +1166,14 @@ pub enum Region {
11691166 ReEmpty ,
11701167}
11711168
1169+ #[ derive( Copy , Clone , PartialEq , Eq , Hash , RustcEncodable , RustcDecodable , Debug ) ]
1170+ pub struct EarlyBoundRegion {
1171+ pub param_id : ast:: NodeId ,
1172+ pub space : subst:: ParamSpace ,
1173+ pub index : u32 ,
1174+ pub name : ast:: Name ,
1175+ }
1176+
11721177/// Upvars do not get their own node-id. Instead, we use the pair of
11731178/// the original var id (that is, the root variable that is referenced
11741179/// by the upvar) and the id of the closure expression.
@@ -1761,7 +1766,12 @@ pub struct RegionParameterDef {
17611766
17621767impl RegionParameterDef {
17631768 pub fn to_early_bound_region ( & self ) -> ty:: Region {
1764- ty:: ReEarlyBound ( self . def_id . node , self . space , self . index , self . name )
1769+ ty:: ReEarlyBound ( ty:: EarlyBoundRegion {
1770+ param_id : self . def_id . node ,
1771+ space : self . space ,
1772+ index : self . index ,
1773+ name : self . name ,
1774+ } )
17651775 }
17661776 pub fn to_bound_region ( & self ) -> ty:: BoundRegion {
17671777 ty:: BoundRegion :: BrNamed ( self . def_id , self . name )
@@ -7071,8 +7081,7 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>,
70717081 let meth_regions: Vec < ty:: Region > =
70727082 method. generics . regions . get_slice ( subst:: FnSpace )
70737083 . iter ( )
7074- . map ( |def| ty:: ReEarlyBound ( def. def_id . node , def. space ,
7075- def. index , def. name ) )
7084+ . map ( |def| def. to_early_bound_region ( ) )
70767085 . collect ( ) ;
70777086 trait_ref. substs . clone ( ) . with_method ( meth_tps, meth_regions)
70787087}
0 commit comments