@@ -958,7 +958,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
958958 // subtype of the region corresponding to an inner
959959 // block.
960960 self . tcx . mk_region ( ReScope (
961- self . tcx . region_maps ( ) . nearest_common_ancestor ( a_id, b_id) ) )
961+ self . tcx . region_maps ( node_id ) . nearest_common_ancestor ( a_id, b_id) ) )
962962 }
963963
964964 ( & ReFree ( _) , & ReFree ( _) ) => {
@@ -1011,9 +1011,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
10111011
10121012 let graph = self . construct_graph ( ) ;
10131013 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) ;
1014+ self . expansion ( free_regions, & mut var_data, subject ) ;
1015+ self . collect_errors ( free_regions, & mut var_data, errors, subject ) ;
1016+ self . collect_var_errors ( free_regions, & var_data, & graph, errors, subject ) ;
10171017 var_data
10181018 }
10191019
@@ -1063,14 +1063,14 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
10631063 match * constraint {
10641064 ConstrainRegSubVar ( a_region, b_vid) => {
10651065 let b_data = & mut var_values[ b_vid. index as usize ] ;
1066- self . expand_node ( free_regions, a_region, b_vid, b_data)
1066+ self . expand_node ( free_regions, a_region, b_vid, b_data, node_id )
10671067 }
10681068 ConstrainVarSubVar ( a_vid, b_vid) => {
10691069 match var_values[ a_vid. index as usize ] {
10701070 ErrorValue => false ,
10711071 Value ( a_region) => {
10721072 let b_node = & mut var_values[ b_vid. index as usize ] ;
1073- self . expand_node ( free_regions, a_region, b_vid, b_node)
1073+ self . expand_node ( free_regions, a_region, b_vid, b_node, node_id )
10741074 }
10751075 }
10761076 }
@@ -1088,7 +1088,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
10881088 free_regions : & FreeRegionMap < ' tcx > ,
10891089 a_region : Region < ' tcx > ,
10901090 b_vid : RegionVid ,
1091- b_data : & mut VarValue < ' tcx > )
1091+ b_data : & mut VarValue < ' tcx > ,
1092+ node_id : ast:: NodeId )
10921093 -> bool {
10931094 debug ! ( "expand_node({:?}, {:?} == {:?})" ,
10941095 a_region,
@@ -1108,7 +1109,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11081109
11091110 match * b_data {
11101111 Value ( cur_region) => {
1111- let lub = self . lub_concrete_regions ( free_regions, a_region, cur_region) ;
1112+ let lub = self . lub_concrete_regions ( free_regions, a_region, cur_region, node_id ) ;
11121113 if lub == cur_region {
11131114 return false ;
11141115 }
@@ -1134,7 +1135,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11341135 fn collect_errors ( & self ,
11351136 free_regions : & FreeRegionMap < ' tcx > ,
11361137 var_data : & mut Vec < VarValue < ' tcx > > ,
1137- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1138+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1139+ node_id : ast:: NodeId ) {
11381140 let constraints = self . constraints . borrow ( ) ;
11391141 for ( constraint, origin) in constraints. iter ( ) {
11401142 debug ! ( "collect_errors: constraint={:?} origin={:?}" ,
@@ -1146,7 +1148,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11461148 }
11471149
11481150 ConstrainRegSubReg ( sub, sup) => {
1149- if free_regions. is_subregion_of ( self . tcx , sub, sup) {
1151+ if free_regions. is_subregion_of ( self . tcx , sub, sup, node_id ) {
11501152 continue ;
11511153 }
11521154
@@ -1174,7 +1176,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11741176 // Do not report these errors immediately:
11751177 // instead, set the variable value to error and
11761178 // collect them later.
1177- if !free_regions. is_subregion_of ( self . tcx , a_region, b_region) {
1179+ if !free_regions. is_subregion_of ( self . tcx , a_region, b_region, node_id ) {
11781180 debug ! ( "collect_errors: region error at {:?}: \
11791181 cannot verify that {:?}={:?} <= {:?}",
11801182 origin,
@@ -1190,7 +1192,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
11901192 for verify in self . verifys . borrow ( ) . iter ( ) {
11911193 debug ! ( "collect_errors: verify={:?}" , verify) ;
11921194 let sub = normalize ( self . tcx , var_data, verify. region ) ;
1193- if verify. bound . is_met ( self . tcx , free_regions, var_data, sub) {
1195+ if verify. bound . is_met ( self . tcx , free_regions, var_data, sub, node_id ) {
11941196 continue ;
11951197 }
11961198
@@ -1212,7 +1214,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
12121214 free_regions : & FreeRegionMap < ' tcx > ,
12131215 var_data : & [ VarValue < ' tcx > ] ,
12141216 graph : & RegionGraph < ' tcx > ,
1215- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1217+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1218+ node_id : ast:: NodeId ) {
12161219 debug ! ( "collect_var_errors" ) ;
12171220
12181221 // This is the best way that I have found to suppress
@@ -1262,7 +1265,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
12621265 graph,
12631266 & mut dup_vec,
12641267 node_vid,
1265- errors) ;
1268+ errors,
1269+ node_id) ;
12661270 }
12671271 }
12681272 }
@@ -1315,7 +1319,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
13151319 graph : & RegionGraph < ' tcx > ,
13161320 dup_vec : & mut [ u32 ] ,
13171321 node_idx : RegionVid ,
1318- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1322+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1323+ node_id : ast:: NodeId ) {
13191324 // Errors in expanding nodes result from a lower-bound that is
13201325 // not contained by an upper-bound.
13211326 let ( mut lower_bounds, lower_dup) = self . collect_concrete_regions ( graph,
@@ -1347,7 +1352,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
13471352
13481353 for lower_bound in & lower_bounds {
13491354 for upper_bound in & upper_bounds {
1350- if !free_regions. is_subregion_of ( self . tcx , lower_bound. region , upper_bound. region ) {
1355+ if !free_regions. is_subregion_of (
1356+ self . tcx , lower_bound. region , upper_bound. region , node_id)
1357+ {
13511358 let origin = ( * self . var_origins . borrow ( ) ) [ node_idx. index as usize ] . clone ( ) ;
13521359 debug ! ( "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
13531360 sup: {:?}",
@@ -1600,20 +1607,20 @@ impl<'a, 'gcx, 'tcx> VerifyBound<'tcx> {
16001607 & VerifyBound :: AnyRegion ( ref rs) =>
16011608 rs. iter ( )
16021609 . map ( |& r| normalize ( tcx, var_values, r) )
1603- . any ( |r| free_regions. is_subregion_of ( tcx, min, r) ) ,
1610+ . any ( |r| free_regions. is_subregion_of ( tcx, min, r, node_id ) ) ,
16041611
16051612 & VerifyBound :: AllRegions ( ref rs) =>
16061613 rs. iter ( )
16071614 . map ( |& r| normalize ( tcx, var_values, r) )
1608- . all ( |r| free_regions. is_subregion_of ( tcx, min, r) ) ,
1615+ . all ( |r| free_regions. is_subregion_of ( tcx, min, r, node_id ) ) ,
16091616
16101617 & VerifyBound :: AnyBound ( ref bs) =>
16111618 bs. iter ( )
1612- . any ( |b| b. is_met ( tcx, free_regions, var_values, min) ) ,
1619+ . any ( |b| b. is_met ( tcx, free_regions, var_values, min, node_id ) ) ,
16131620
16141621 & VerifyBound :: AllBounds ( ref bs) =>
16151622 bs. iter ( )
1616- . all ( |b| b. is_met ( tcx, free_regions, var_values, min) ) ,
1623+ . all ( |b| b. is_met ( tcx, free_regions, var_values, min, node_id ) ) ,
16171624 }
16181625 }
16191626}
0 commit comments