@@ -112,19 +112,18 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
112
112
/// to find a good name from that. Returns `None` if we can't find
113
113
/// one (e.g., this is just some random part of the CFG).
114
114
pub ( super ) fn to_error_region ( & self , r : RegionVid ) -> Option < ty:: Region < ' tcx > > {
115
- self . to_error_region_vid ( r)
116
- . and_then ( |r| self . nonlexical_regioncx . region_definition ( r) . external_name )
115
+ self . to_error_region_vid ( r) . and_then ( |r| self . regioncx . region_definition ( r) . external_name )
117
116
}
118
117
119
118
/// Returns the `RegionVid` corresponding to the region returned by
120
119
/// `to_error_region`.
121
120
pub ( super ) fn to_error_region_vid ( & self , r : RegionVid ) -> Option < RegionVid > {
122
- if self . nonlexical_regioncx . universal_regions ( ) . is_universal_region ( r) {
121
+ if self . regioncx . universal_regions ( ) . is_universal_region ( r) {
123
122
Some ( r)
124
123
} else {
125
- let upper_bound = self . nonlexical_regioncx . universal_upper_bound ( r) ;
124
+ let upper_bound = self . regioncx . universal_upper_bound ( r) ;
126
125
127
- if self . nonlexical_regioncx . upper_bound_in_region_scc ( r, upper_bound) {
126
+ if self . regioncx . upper_bound_in_region_scc ( r, upper_bound) {
128
127
self . to_error_region_vid ( upper_bound)
129
128
} else {
130
129
None
@@ -137,7 +136,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
137
136
if let Some ( ty:: ReFree ( free_region) ) = self . to_error_region ( fr) {
138
137
if let ty:: BoundRegion :: BrEnv = free_region. bound_region {
139
138
if let DefiningTy :: Closure ( def_id, substs) =
140
- self . nonlexical_regioncx . universal_regions ( ) . defining_ty
139
+ self . regioncx . universal_regions ( ) . defining_ty
141
140
{
142
141
let closure_kind_ty = substs. as_closure ( ) . kind_ty ( def_id, self . infcx . tcx ) ;
143
142
return Some ( ty:: ClosureKind :: FnMut ) == closure_kind_ty. to_opt_closure_kind ( ) ;
@@ -219,11 +218,10 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
219
218
fr_origin,
220
219
error_element,
221
220
} => {
222
- let error_region =
223
- self . nonlexical_regioncx . region_from_element ( longer_fr, error_element) ;
221
+ let error_region = self . regioncx . region_from_element ( longer_fr, error_element) ;
224
222
225
223
// Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
226
- let ( _, span) = self . nonlexical_regioncx . find_outlives_blame_span (
224
+ let ( _, span) = self . regioncx . find_outlives_blame_span (
227
225
& self . body ,
228
226
longer_fr,
229
227
fr_origin,
@@ -286,8 +284,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
286
284
debug ! ( "report_error(fr={:?}, outlived_fr={:?})" , fr, outlived_fr) ;
287
285
288
286
let ( category, _, span) =
289
- self . nonlexical_regioncx . best_blame_constraint ( & self . body , fr, fr_origin, |r| {
290
- self . nonlexical_regioncx . provides_universal_region ( r, fr, outlived_fr)
287
+ self . regioncx . best_blame_constraint ( & self . body , fr, fr_origin, |r| {
288
+ self . regioncx . provides_universal_region ( r, fr, outlived_fr)
291
289
} ) ;
292
290
293
291
debug ! ( "report_error: category={:?} {:?}" , category, span) ;
@@ -302,8 +300,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
302
300
}
303
301
304
302
let ( fr_is_local, outlived_fr_is_local) : ( bool , bool ) = (
305
- self . nonlexical_regioncx . universal_regions ( ) . is_local_free_region ( fr) ,
306
- self . nonlexical_regioncx . universal_regions ( ) . is_local_free_region ( outlived_fr) ,
303
+ self . regioncx . universal_regions ( ) . is_local_free_region ( fr) ,
304
+ self . regioncx . universal_regions ( ) . is_local_free_region ( outlived_fr) ,
307
305
) ;
308
306
309
307
debug ! (
@@ -378,7 +376,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
378
376
// We should check if the return type of this closure is in fact a closure - in that
379
377
// case, we can special case the error further.
380
378
let return_type_is_closure =
381
- self . nonlexical_regioncx . universal_regions ( ) . unnormalized_output_ty . is_closure ( ) ;
379
+ self . regioncx . universal_regions ( ) . unnormalized_output_ty . is_closure ( ) ;
382
380
let message = if return_type_is_closure {
383
381
"returns a closure that contains a reference to a captured variable, which then \
384
382
escapes the closure body"
@@ -430,22 +428,22 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
430
428
) -> DiagnosticBuilder < ' tcx > {
431
429
let ErrorConstraintInfo { span, category, .. } = errci;
432
430
433
- let fr_name_and_span = self . nonlexical_regioncx . get_var_name_and_span_for_region (
431
+ let fr_name_and_span = self . regioncx . get_var_name_and_span_for_region (
434
432
self . infcx . tcx ,
435
433
& self . body ,
436
434
& self . local_names ,
437
435
& self . upvars ,
438
436
errci. fr ,
439
437
) ;
440
- let outlived_fr_name_and_span = self . nonlexical_regioncx . get_var_name_and_span_for_region (
438
+ let outlived_fr_name_and_span = self . regioncx . get_var_name_and_span_for_region (
441
439
self . infcx . tcx ,
442
440
& self . body ,
443
441
& self . local_names ,
444
442
& self . upvars ,
445
443
errci. outlived_fr ,
446
444
) ;
447
445
448
- let escapes_from = match self . nonlexical_regioncx . universal_regions ( ) . defining_ty {
446
+ let escapes_from = match self . regioncx . universal_regions ( ) . defining_ty {
449
447
DefiningTy :: Closure ( ..) => "closure" ,
450
448
DefiningTy :: Generator ( ..) => "generator" ,
451
449
DefiningTy :: FnDef ( ..) => "function" ,
0 commit comments