@@ -1159,10 +1159,45 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1159
1159
/// result. After this, no more unification operations should be
1160
1160
/// done -- or the compiler will panic -- but it is legal to use
1161
1161
/// `resolve_type_vars_if_possible` as well as `fully_resolve`.
1162
- pub fn resolve_regions_and_report_errors ( & self ,
1163
- region_context : DefId ,
1164
- region_map : & region:: ScopeTree ,
1165
- outlives_env : & OutlivesEnvironment < ' tcx > ) {
1162
+ pub fn resolve_regions_and_report_errors (
1163
+ & self ,
1164
+ region_context : DefId ,
1165
+ region_map : & region:: ScopeTree ,
1166
+ outlives_env : & OutlivesEnvironment < ' tcx > ,
1167
+ ) {
1168
+ self . resolve_regions_and_report_errors_inner (
1169
+ region_context,
1170
+ region_map,
1171
+ outlives_env,
1172
+ false ,
1173
+ )
1174
+ }
1175
+
1176
+ /// Like `resolve_regions_and_report_errors`, but skips error
1177
+ /// reporting if NLL is enabled. This is used for fn bodies where
1178
+ /// the same error may later be reported by the NLL-based
1179
+ /// inference.
1180
+ pub fn resolve_regions_and_report_errors_unless_nll (
1181
+ & self ,
1182
+ region_context : DefId ,
1183
+ region_map : & region:: ScopeTree ,
1184
+ outlives_env : & OutlivesEnvironment < ' tcx > ,
1185
+ ) {
1186
+ self . resolve_regions_and_report_errors_inner (
1187
+ region_context,
1188
+ region_map,
1189
+ outlives_env,
1190
+ true ,
1191
+ )
1192
+ }
1193
+
1194
+ fn resolve_regions_and_report_errors_inner (
1195
+ & self ,
1196
+ region_context : DefId ,
1197
+ region_map : & region:: ScopeTree ,
1198
+ outlives_env : & OutlivesEnvironment < ' tcx > ,
1199
+ will_later_be_reported_by_nll : bool ,
1200
+ ) {
1166
1201
assert ! ( self . is_tainted_by_errors( ) || self . region_obligations. borrow( ) . is_empty( ) ,
1167
1202
"region_obligations not empty: {:#?}" ,
1168
1203
self . region_obligations. borrow( ) ) ;
@@ -1187,7 +1222,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
1187
1222
// this infcx was in use. This is totally hokey but
1188
1223
// otherwise we have a hard time separating legit region
1189
1224
// errors from silly ones.
1190
- self . report_region_errors ( region_map, & errors) ; // see error_reporting module
1225
+ self . report_region_errors ( region_map, & errors, will_later_be_reported_by_nll ) ;
1191
1226
}
1192
1227
}
1193
1228
0 commit comments