@@ -958,7 +958,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
958
958
// subtype of the region corresponding to an inner
959
959
// block.
960
960
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) ) )
962
962
}
963
963
964
964
( & ReFree ( _) , & ReFree ( _) ) => {
@@ -1011,9 +1011,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1011
1011
1012
1012
let graph = self . construct_graph ( ) ;
1013
1013
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 ) ;
1017
1017
var_data
1018
1018
}
1019
1019
@@ -1063,14 +1063,14 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1063
1063
match * constraint {
1064
1064
ConstrainRegSubVar ( a_region, b_vid) => {
1065
1065
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 )
1067
1067
}
1068
1068
ConstrainVarSubVar ( a_vid, b_vid) => {
1069
1069
match var_values[ a_vid. index as usize ] {
1070
1070
ErrorValue => false ,
1071
1071
Value ( a_region) => {
1072
1072
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 )
1074
1074
}
1075
1075
}
1076
1076
}
@@ -1088,7 +1088,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1088
1088
free_regions : & FreeRegionMap < ' tcx > ,
1089
1089
a_region : Region < ' tcx > ,
1090
1090
b_vid : RegionVid ,
1091
- b_data : & mut VarValue < ' tcx > )
1091
+ b_data : & mut VarValue < ' tcx > ,
1092
+ node_id : ast:: NodeId )
1092
1093
-> bool {
1093
1094
debug ! ( "expand_node({:?}, {:?} == {:?})" ,
1094
1095
a_region,
@@ -1108,7 +1109,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1108
1109
1109
1110
match * b_data {
1110
1111
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 ) ;
1112
1113
if lub == cur_region {
1113
1114
return false ;
1114
1115
}
@@ -1134,7 +1135,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1134
1135
fn collect_errors ( & self ,
1135
1136
free_regions : & FreeRegionMap < ' tcx > ,
1136
1137
var_data : & mut Vec < VarValue < ' tcx > > ,
1137
- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1138
+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1139
+ node_id : ast:: NodeId ) {
1138
1140
let constraints = self . constraints . borrow ( ) ;
1139
1141
for ( constraint, origin) in constraints. iter ( ) {
1140
1142
debug ! ( "collect_errors: constraint={:?} origin={:?}" ,
@@ -1146,7 +1148,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1146
1148
}
1147
1149
1148
1150
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 ) {
1150
1152
continue ;
1151
1153
}
1152
1154
@@ -1174,7 +1176,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1174
1176
// Do not report these errors immediately:
1175
1177
// instead, set the variable value to error and
1176
1178
// 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 ) {
1178
1180
debug ! ( "collect_errors: region error at {:?}: \
1179
1181
cannot verify that {:?}={:?} <= {:?}",
1180
1182
origin,
@@ -1190,7 +1192,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1190
1192
for verify in self . verifys . borrow ( ) . iter ( ) {
1191
1193
debug ! ( "collect_errors: verify={:?}" , verify) ;
1192
1194
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 ) {
1194
1196
continue ;
1195
1197
}
1196
1198
@@ -1212,7 +1214,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1212
1214
free_regions : & FreeRegionMap < ' tcx > ,
1213
1215
var_data : & [ VarValue < ' tcx > ] ,
1214
1216
graph : & RegionGraph < ' tcx > ,
1215
- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1217
+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1218
+ node_id : ast:: NodeId ) {
1216
1219
debug ! ( "collect_var_errors" ) ;
1217
1220
1218
1221
// This is the best way that I have found to suppress
@@ -1262,7 +1265,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1262
1265
graph,
1263
1266
& mut dup_vec,
1264
1267
node_vid,
1265
- errors) ;
1268
+ errors,
1269
+ node_id) ;
1266
1270
}
1267
1271
}
1268
1272
}
@@ -1315,7 +1319,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1315
1319
graph : & RegionGraph < ' tcx > ,
1316
1320
dup_vec : & mut [ u32 ] ,
1317
1321
node_idx : RegionVid ,
1318
- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1322
+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1323
+ node_id : ast:: NodeId ) {
1319
1324
// Errors in expanding nodes result from a lower-bound that is
1320
1325
// not contained by an upper-bound.
1321
1326
let ( mut lower_bounds, lower_dup) = self . collect_concrete_regions ( graph,
@@ -1347,7 +1352,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1347
1352
1348
1353
for lower_bound in & lower_bounds {
1349
1354
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
+ {
1351
1358
let origin = ( * self . var_origins . borrow ( ) ) [ node_idx. index as usize ] . clone ( ) ;
1352
1359
debug ! ( "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
1353
1360
sup: {:?}",
@@ -1600,20 +1607,20 @@ impl<'a, 'gcx, 'tcx> VerifyBound<'tcx> {
1600
1607
& VerifyBound :: AnyRegion ( ref rs) =>
1601
1608
rs. iter ( )
1602
1609
. 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 ) ) ,
1604
1611
1605
1612
& VerifyBound :: AllRegions ( ref rs) =>
1606
1613
rs. iter ( )
1607
1614
. 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 ) ) ,
1609
1616
1610
1617
& VerifyBound :: AnyBound ( ref bs) =>
1611
1618
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 ) ) ,
1613
1620
1614
1621
& VerifyBound :: AllBounds ( ref bs) =>
1615
1622
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 ) ) ,
1617
1624
}
1618
1625
}
1619
1626
}
0 commit comments