@@ -905,7 +905,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
905
905
fn lub_concrete_regions ( & self ,
906
906
free_regions : & FreeRegionMap ,
907
907
a : & ' tcx Region ,
908
- b : & ' tcx Region )
908
+ b : & ' tcx Region ,
909
+ node_id : ast:: NodeId )
909
910
-> & ' tcx Region {
910
911
match ( a, b) {
911
912
( & ReLateBound ( ..) , _) |
@@ -938,7 +939,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
938
939
// A "free" region can be interpreted as "some region
939
940
// at least as big as the block fr.scope_id". So, we can
940
941
// reasonably compare free regions and scopes:
941
- let r_id = self . tcx . region_maps ( )
942
+ let r_id = self . tcx . region_maps ( node_id )
942
943
. nearest_common_ancestor ( fr. scope , s_id) ;
943
944
944
945
if r_id == fr. scope {
@@ -958,7 +959,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
958
959
// subtype of the region corresponding to an inner
959
960
// block.
960
961
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) ) )
962
963
}
963
964
964
965
( & ReFree ( a_fr) , & ReFree ( b_fr) ) => {
@@ -1011,9 +1012,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1011
1012
1012
1013
let graph = self . construct_graph ( ) ;
1013
1014
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 ) ;
1017
1018
var_data
1018
1019
}
1019
1020
@@ -1056,21 +1057,25 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1056
1057
}
1057
1058
}
1058
1059
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
+ {
1060
1065
self . iterate_until_fixed_point ( "Expansion" , |constraint, origin| {
1061
1066
debug ! ( "expansion: constraint={:?} origin={:?}" ,
1062
1067
constraint, origin) ;
1063
1068
match * constraint {
1064
1069
ConstrainRegSubVar ( a_region, b_vid) => {
1065
1070
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 )
1067
1072
}
1068
1073
ConstrainVarSubVar ( a_vid, b_vid) => {
1069
1074
match var_values[ a_vid. index as usize ] {
1070
1075
ErrorValue => false ,
1071
1076
Value ( a_region) => {
1072
1077
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 )
1074
1079
}
1075
1080
}
1076
1081
}
@@ -1088,7 +1093,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1088
1093
free_regions : & FreeRegionMap ,
1089
1094
a_region : & ' tcx Region ,
1090
1095
b_vid : RegionVid ,
1091
- b_data : & mut VarValue < ' tcx > )
1096
+ b_data : & mut VarValue < ' tcx > ,
1097
+ node_id : ast:: NodeId )
1092
1098
-> bool {
1093
1099
debug ! ( "expand_node({:?}, {:?} == {:?})" ,
1094
1100
a_region,
@@ -1108,7 +1114,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1108
1114
1109
1115
match * b_data {
1110
1116
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 ) ;
1112
1118
if lub == cur_region {
1113
1119
return false ;
1114
1120
}
@@ -1134,7 +1140,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1134
1140
fn collect_errors ( & self ,
1135
1141
free_regions : & FreeRegionMap ,
1136
1142
var_data : & mut Vec < VarValue < ' tcx > > ,
1137
- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1143
+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1144
+ node_id : ast:: NodeId ) {
1138
1145
let constraints = self . constraints . borrow ( ) ;
1139
1146
for ( constraint, origin) in constraints. iter ( ) {
1140
1147
debug ! ( "collect_errors: constraint={:?} origin={:?}" ,
@@ -1146,7 +1153,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1146
1153
}
1147
1154
1148
1155
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 ) {
1150
1157
continue ;
1151
1158
}
1152
1159
@@ -1174,7 +1181,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1174
1181
// Do not report these errors immediately:
1175
1182
// instead, set the variable value to error and
1176
1183
// 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 ) {
1178
1185
debug ! ( "collect_errors: region error at {:?}: \
1179
1186
cannot verify that {:?}={:?} <= {:?}",
1180
1187
origin,
@@ -1190,7 +1197,7 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1190
1197
for verify in self . verifys . borrow ( ) . iter ( ) {
1191
1198
debug ! ( "collect_errors: verify={:?}" , verify) ;
1192
1199
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 ) {
1194
1201
continue ;
1195
1202
}
1196
1203
@@ -1212,7 +1219,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1212
1219
free_regions : & FreeRegionMap ,
1213
1220
var_data : & [ VarValue < ' tcx > ] ,
1214
1221
graph : & RegionGraph < ' tcx > ,
1215
- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1222
+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1223
+ node_id : ast:: NodeId ) {
1216
1224
debug ! ( "collect_var_errors" ) ;
1217
1225
1218
1226
// This is the best way that I have found to suppress
@@ -1262,7 +1270,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1262
1270
graph,
1263
1271
& mut dup_vec,
1264
1272
node_vid,
1265
- errors) ;
1273
+ errors,
1274
+ node_id) ;
1266
1275
}
1267
1276
}
1268
1277
}
@@ -1315,7 +1324,8 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1315
1324
graph : & RegionGraph < ' tcx > ,
1316
1325
dup_vec : & mut [ u32 ] ,
1317
1326
node_idx : RegionVid ,
1318
- errors : & mut Vec < RegionResolutionError < ' tcx > > ) {
1327
+ errors : & mut Vec < RegionResolutionError < ' tcx > > ,
1328
+ node_id : ast:: NodeId ) {
1319
1329
// Errors in expanding nodes result from a lower-bound that is
1320
1330
// not contained by an upper-bound.
1321
1331
let ( mut lower_bounds, lower_dup) = self . collect_concrete_regions ( graph,
@@ -1347,7 +1357,9 @@ impl<'a, 'gcx, 'tcx> RegionVarBindings<'a, 'gcx, 'tcx> {
1347
1357
1348
1358
for lower_bound in & lower_bounds {
1349
1359
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
+ {
1351
1363
let origin = ( * self . var_origins . borrow ( ) ) [ node_idx. index as usize ] . clone ( ) ;
1352
1364
debug ! ( "region inference error at {:?} for {:?}: SubSupConflict sub: {:?} \
1353
1365
sup: {:?}",
@@ -1594,26 +1606,27 @@ impl<'a, 'gcx, 'tcx> VerifyBound<'tcx> {
1594
1606
fn is_met ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ,
1595
1607
free_regions : & FreeRegionMap ,
1596
1608
var_values : & Vec < VarValue < ' tcx > > ,
1597
- min : & ' tcx ty:: Region )
1609
+ min : & ' tcx ty:: Region ,
1610
+ node_id : ast:: NodeId )
1598
1611
-> bool {
1599
1612
match self {
1600
1613
& VerifyBound :: AnyRegion ( ref rs) =>
1601
1614
rs. iter ( )
1602
1615
. 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 ) ) ,
1604
1617
1605
1618
& VerifyBound :: AllRegions ( ref rs) =>
1606
1619
rs. iter ( )
1607
1620
. 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 ) ) ,
1609
1622
1610
1623
& VerifyBound :: AnyBound ( ref bs) =>
1611
1624
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 ) ) ,
1613
1626
1614
1627
& VerifyBound :: AllBounds ( ref bs) =>
1615
1628
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 ) ) ,
1617
1630
}
1618
1631
}
1619
1632
}
0 commit comments