@@ -905,7 +905,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
905905 fn lub_concrete_regions ( & self ,
906906 free_regions : & FreeRegionMap ,
907907 a : & ' tcx Region ,
908- b : & ' tcx Region )
908+ b : & ' tcx Region ,
909+ node_id : ast:: NodeId )
909910 -> & ' tcx Region {
910911 match ( a, b) {
911912 ( & ReLateBound ( ..) , _) |
@@ -938,7 +939,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
938939 // A "free" region can be interpreted as "some region
939940 // at least as big as the block fr.scope_id". So, we can
940941 // reasonably compare free regions and scopes:
941- let r_id = self . tcx . region_maps ( )
942+ let r_id = self . tcx . region_maps ( node_id )
942943 . nearest_common_ancestor ( fr. scope , s_id) ;
943944
944945 if r_id == fr. scope {
@@ -958,7 +959,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
958959 // subtype of the region corresponding to an inner
959960 // block.
960961 self . tcx . mk_region ( ReScope (
961- self . tcx . region_maps ( ) . nearest_common_ancestor ( a_id, b_id) ) )
962+ self . tcx . region_maps ( node_id ) . nearest_common_ancestor ( a_id, b_id) ) )
962963 }
963964
964965 ( & ReFree ( a_fr) , & ReFree ( b_fr) ) => {
@@ -1011,9 +1012,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
10111012
10121013 let graph = self . construct_graph ( ) ;
10131014 self . expand_givens ( & graph) ;
1014- self . expansion ( free_regions, & mut var_data) ;
1015- self . collect_errors ( free_regions, & mut var_data, errors) ;
1016- self . collect_var_errors ( free_regions, & var_data, & graph, errors) ;
1015+ self . expansion ( free_regions, & mut var_data, subject ) ;
1016+ self . collect_errors ( free_regions, & mut var_data, errors, subject ) ;
1017+ self . collect_var_errors ( free_regions, & var_data, & graph, errors, subject ) ;
10171018 var_data
10181019 }
10191020
@@ -1056,21 +1057,25 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
10561057 }
10571058 }
10581059
1059- fn expansion ( & self , free_regions : & FreeRegionMap , var_values : & mut [ VarValue < ' tcx > ] ) {
1060+ fn expansion ( & self ,
1061+ free_regions : & FreeRegionMap ,
1062+ var_values : & mut [ VarValue < ' tcx > ] ,
1063+ node_id : ast:: NodeId )
1064+ {
10601065 self . iterate_until_fixed_point ( "Expansion" , |constraint, origin| {
10611066 debug ! ( "expansion: constraint={:?} origin={:?}" ,
10621067 constraint, origin) ;
10631068 match * constraint {
10641069 ConstrainRegSubVar ( a_region, b_vid) => {
10651070 let b_data = & mut var_values[ b_vid. index as usize ] ;
1066- self . expand_node ( free_regions, a_region, b_vid, b_data)
1071+ self . expand_node ( free_regions, a_region, b_vid, b_data, node_id )
10671072 }
10681073 ConstrainVarSubVar ( a_vid, b_vid) => {
10691074 match var_values[ a_vid. index as usize ] {
10701075 ErrorValue => false ,
10711076 Value ( a_region) => {
10721077 let b_node = & mut var_values[ b_vid. index as usize ] ;
1073- self . expand_node ( free_regions, a_region, b_vid, b_node)
1078+ self . expand_node ( free_regions, a_region, b_vid, b_node, node_id )
10741079 }
10751080 }
10761081 }
@@ -1088,7 +1093,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
10881093 free_regions : & FreeRegionMap ,
10891094 a_region : & ' tcx Region ,
10901095 b_vid : RegionVid ,
1091- b_data : & mut VarValue < ' tcx > )
1096+ b_data : & mut VarValue < ' tcx > ,
1097+ node_id : ast:: NodeId )
10921098 -> bool {
10931099 debug ! ( "expand_node({:?}, {:?} == {:?})" ,
10941100 a_region,
@@ -1108,7 +1114,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11081114
11091115 match * b_data {
11101116 Value ( cur_region) => {
1111- let lub = self . lub_concrete_regions ( free_regions, a_region, cur_region) ;
1117+ let lub = self . lub_concrete_regions ( free_regions, a_region, cur_region, node_id ) ;
11121118 if lub == cur_region {
11131119 return false ;
11141120 }
@@ -1134,7 +1140,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11341140 fn collect_errors ( & self ,
11351141 free_regions : & FreeRegionMap ,
11361142 var_data : & mut Vec < VarValue < ' tcx > > ,
1137- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1143+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1144+ node_id : ast:: NodeId ) {
11381145 let constraints = self . constraints . borrow ( ) ;
11391146 for ( constraint, origin) in constraints. iter ( ) {
11401147 debug ! ( "collect_errors: constraint={:?} origin={:?}" ,
@@ -1146,7 +1153,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11461153 }
11471154
11481155 ConstrainRegSubReg ( sub, sup) => {
1149- if free_regions. is_subregion_of ( self . tcx , sub, sup) {
1156+ if free_regions. is_subregion_of ( self . tcx , sub, sup, node_id ) {
11501157 continue ;
11511158 }
11521159
@@ -1174,7 +1181,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11741181 // Do not report these errors immediately:
11751182 // instead, set the variable value to error and
11761183 // collect them later.
1177- if !free_regions. is_subregion_of ( self . tcx , a_region, b_region) {
1184+ if !free_regions. is_subregion_of ( self . tcx , a_region, b_region, node_id ) {
11781185 debug ! ( "collect_errors: region error at {:?}: \
11791186 cannot verify that {:?}={:?} <= {:?}",
11801187 origin,
@@ -1190,7 +1197,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11901197 for verify in self . verifys . borrow ( ) . iter ( ) {
11911198 debug ! ( "collect_errors: verify={:?}" , verify) ;
11921199 let sub = normalize ( self . tcx , var_data, verify. region ) ;
1193- if verify. bound . is_met ( self . tcx , free_regions, var_data, sub) {
1200+ if verify. bound . is_met ( self . tcx , free_regions, var_data, sub, node_id ) {
11941201 continue ;
11951202 }
11961203
@@ -1212,7 +1219,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
12121219 free_regions : & FreeRegionMap ,
12131220 var_data : & [ VarValue < ' tcx > ] ,
12141221 graph : & RegionGraph < ' tcx > ,
1215- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1222+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1223+ node_id : ast:: NodeId ) {
12161224 debug ! ( "collect_var_errors" ) ;
12171225
12181226 // This is the best way that I have found to suppress
@@ -1262,7 +1270,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
12621270 graph,
12631271 & mut dup_vec,
12641272 node_vid,
1265- errors) ;
1273+ errors,
1274+ node_id) ;
12661275 }
12671276 }
12681277 }
@@ -1315,7 +1324,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
13151324 graph : & RegionGraph < ' tcx > ,
13161325 dup_vec : & mut [ u32 ] ,
13171326 node_idx : RegionVid ,
1318- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1327+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1328+ node_id : ast:: NodeId ) {
13191329 // Errors in expanding nodes result from a lower-bound that is
13201330 // not contained by an upper-bound.
13211331 let ( mut lower_bounds, lower_dup) = self . collect_concrete_regions ( graph,
@@ -1347,7 +1357,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
13471357
13481358 for lower_bound in & lower_bounds {
13491359 for upper_bound in & upper_bounds {
1350- if !free_regions. is_subregion_of ( self . tcx , lower_bound. region , upper_bound. region ) {
1360+ if !free_regions. is_subregion_of (
1361+ self . tcx , lower_bound. region , upper_bound. region , node_id)
1362+ {
13511363 let origin = ( * self . var_origins . borrow ( ) ) [ node_idx. index as usize ] . clone ( ) ;
13521364 debug ! ( "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
13531365 sup: {:?}",
@@ -1594,26 +1606,27 @@ impl<'a, 'gcx, 'tcx> VerifyBound<'tcx> {
15941606 fn is_met ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
15951607 free_regions : & FreeRegionMap ,
15961608 var_values : & Vec < VarValue < ' tcx > > ,
1597- min : & ' tcx ty:: Region )
1609+ min : & ' tcx ty:: Region ,
1610+ node_id : ast:: NodeId )
15981611 -> bool {
15991612 match self {
16001613 & VerifyBound :: AnyRegion ( ref rs) =>
16011614 rs. iter ( )
16021615 . map ( |& r| normalize ( tcx, var_values, r) )
1603- . any ( |r| free_regions. is_subregion_of ( tcx, min, r) ) ,
1616+ . any ( |r| free_regions. is_subregion_of ( tcx, min, r, node_id ) ) ,
16041617
16051618 & VerifyBound :: AllRegions ( ref rs) =>
16061619 rs. iter ( )
16071620 . map ( |& r| normalize ( tcx, var_values, r) )
1608- . all ( |r| free_regions. is_subregion_of ( tcx, min, r) ) ,
1621+ . all ( |r| free_regions. is_subregion_of ( tcx, min, r, node_id ) ) ,
16091622
16101623 & VerifyBound :: AnyBound ( ref bs) =>
16111624 bs. iter ( )
1612- . any ( |b| b. is_met ( tcx, free_regions, var_values, min) ) ,
1625+ . any ( |b| b. is_met ( tcx, free_regions, var_values, min, node_id ) ) ,
16131626
16141627 & VerifyBound :: AllBounds ( ref bs) =>
16151628 bs. iter ( )
1616- . all ( |b| b. is_met ( tcx, free_regions, var_values, min) ) ,
1629+ . all ( |b| b. is_met ( tcx, free_regions, var_values, min, node_id ) ) ,
16171630 }
16181631 }
16191632}
0 commit comments