@@ -1134,10 +1134,7 @@ pub enum Region {
1134
1134
// Region bound in a type or fn declaration which will be
1135
1135
// substituted 'early' -- that is, at the same time when type
1136
1136
// parameters are substituted.
1137
- ReEarlyBound ( /* param id */ ast:: NodeId ,
1138
- subst:: ParamSpace ,
1139
- /*index*/ u32 ,
1140
- ast:: Name ) ,
1137
+ ReEarlyBound ( EarlyBoundRegion ) ,
1141
1138
1142
1139
// Region bound in a function scope, which will be substituted when the
1143
1140
// function is called.
@@ -1169,6 +1166,14 @@ pub enum Region {
1169
1166
ReEmpty ,
1170
1167
}
1171
1168
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
+
1172
1177
/// Upvars do not get their own node-id. Instead, we use the pair of
1173
1178
/// the original var id (that is, the root variable that is referenced
1174
1179
/// by the upvar) and the id of the closure expression.
@@ -1761,7 +1766,12 @@ pub struct RegionParameterDef {
1761
1766
1762
1767
impl RegionParameterDef {
1763
1768
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
+ } )
1765
1775
}
1766
1776
pub fn to_bound_region ( & self ) -> ty:: BoundRegion {
1767
1777
ty:: BoundRegion :: BrNamed ( self . def_id , self . name )
@@ -7071,8 +7081,7 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>,
7071
7081
let meth_regions: Vec < ty:: Region > =
7072
7082
method. generics . regions . get_slice ( subst:: FnSpace )
7073
7083
. 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 ( ) )
7076
7085
. collect ( ) ;
7077
7086
trait_ref. substs . clone ( ) . with_method ( meth_tps, meth_regions)
7078
7087
}
0 commit comments