@@ -23,14 +23,14 @@ pub(crate) struct RegionName {
23
23
}
24
24
25
25
/// Denotes the source of a region that is named by a `RegionName`. For example, a free region that
26
- /// was named by the user would get `NamedFreeRegion ` and `'static` lifetime would get `Static`.
26
+ /// was named by the user would get `NamedLateParamRegion ` and `'static` lifetime would get `Static`.
27
27
/// This helps to print the right kinds of diagnostics.
28
28
#[ derive( Debug , Clone ) ]
29
29
pub ( crate ) enum RegionNameSource {
30
30
/// A bound (not free) region that was instantiated at the def site (not an HRTB).
31
- NamedEarlyBoundRegion ( Span ) ,
31
+ NamedEarlyParamRegion ( Span ) ,
32
32
/// A free region that the user has a name (`'a`) for.
33
- NamedFreeRegion ( Span ) ,
33
+ NamedLateParamRegion ( Span ) ,
34
34
/// The `'static` region.
35
35
Static ,
36
36
/// The free region corresponding to the environment of a closure.
@@ -69,8 +69,8 @@ pub(crate) enum RegionNameHighlight {
69
69
impl RegionName {
70
70
pub ( crate ) fn was_named ( & self ) -> bool {
71
71
match self . source {
72
- RegionNameSource :: NamedEarlyBoundRegion ( ..)
73
- | RegionNameSource :: NamedFreeRegion ( ..)
72
+ RegionNameSource :: NamedEarlyParamRegion ( ..)
73
+ | RegionNameSource :: NamedLateParamRegion ( ..)
74
74
| RegionNameSource :: Static => true ,
75
75
RegionNameSource :: SynthesizedFreeEnvRegion ( ..)
76
76
| RegionNameSource :: AnonRegionFromArgument ( ..)
@@ -85,8 +85,8 @@ impl RegionName {
85
85
pub ( crate ) fn span ( & self ) -> Option < Span > {
86
86
match self . source {
87
87
RegionNameSource :: Static => None ,
88
- RegionNameSource :: NamedEarlyBoundRegion ( span)
89
- | RegionNameSource :: NamedFreeRegion ( span)
88
+ RegionNameSource :: NamedEarlyParamRegion ( span)
89
+ | RegionNameSource :: NamedLateParamRegion ( span)
90
90
| RegionNameSource :: SynthesizedFreeEnvRegion ( span, _)
91
91
| RegionNameSource :: AnonRegionFromUpvar ( span, _)
92
92
| RegionNameSource :: AnonRegionFromYieldTy ( span, _)
@@ -104,8 +104,8 @@ impl RegionName {
104
104
105
105
pub ( crate ) fn highlight_region_name ( & self , diag : & mut Diagnostic ) {
106
106
match & self . source {
107
- RegionNameSource :: NamedFreeRegion ( span)
108
- | RegionNameSource :: NamedEarlyBoundRegion ( span) => {
107
+ RegionNameSource :: NamedLateParamRegion ( span)
108
+ | RegionNameSource :: NamedEarlyParamRegion ( span) => {
109
109
diag. span_label ( * span, format ! ( "lifetime `{self}` defined here" ) ) ;
110
110
}
111
111
RegionNameSource :: SynthesizedFreeEnvRegion ( span, note) => {
@@ -280,28 +280,31 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
280
280
281
281
debug ! ( "give_region_a_name: error_region = {:?}" , error_region) ;
282
282
match * error_region {
283
- ty:: ReEarlyBound ( ebr) => ebr. has_name ( ) . then ( || {
283
+ ty:: ReEarlyParam ( ebr) => ebr. has_name ( ) . then ( || {
284
284
let span = tcx. hir ( ) . span_if_local ( ebr. def_id ) . unwrap_or ( DUMMY_SP ) ;
285
- RegionName { name : ebr. name , source : RegionNameSource :: NamedEarlyBoundRegion ( span) }
285
+ RegionName { name : ebr. name , source : RegionNameSource :: NamedEarlyParamRegion ( span) }
286
286
} ) ,
287
287
288
288
ty:: ReStatic => {
289
289
Some ( RegionName { name : kw:: StaticLifetime , source : RegionNameSource :: Static } )
290
290
}
291
291
292
- ty:: ReFree ( free_region ) => match free_region . bound_region {
292
+ ty:: ReLateParam ( late_param ) => match late_param . bound_region {
293
293
ty:: BoundRegionKind :: BrNamed ( region_def_id, name) => {
294
294
// Get the span to point to, even if we don't use the name.
295
295
let span = tcx. hir ( ) . span_if_local ( region_def_id) . unwrap_or ( DUMMY_SP ) ;
296
296
debug ! (
297
297
"bound region named: {:?}, is_named: {:?}" ,
298
298
name,
299
- free_region . bound_region. is_named( )
299
+ late_param . bound_region. is_named( )
300
300
) ;
301
301
302
- if free_region . bound_region . is_named ( ) {
302
+ if late_param . bound_region . is_named ( ) {
303
303
// A named region that is actually named.
304
- Some ( RegionName { name, source : RegionNameSource :: NamedFreeRegion ( span) } )
304
+ Some ( RegionName {
305
+ name,
306
+ source : RegionNameSource :: NamedLateParamRegion ( span) ,
307
+ } )
305
308
} else if tcx. asyncness ( self . mir_hir_id ( ) . owner ) . is_async ( ) {
306
309
// If we spuriously thought that the region is named, we should let the
307
310
// system generate a true name for error messages. Currently this can
@@ -847,7 +850,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
847
850
& self ,
848
851
fr : RegionVid ,
849
852
) -> Option < RegionName > {
850
- let ty:: ReEarlyBound ( region) = * self . to_error_region ( fr) ? else {
853
+ let ty:: ReEarlyParam ( region) = * self . to_error_region ( fr) ? else {
851
854
return None ;
852
855
} ;
853
856
if region. has_name ( ) {
@@ -862,7 +865,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
862
865
863
866
let found = tcx
864
867
. any_free_region_meets ( & tcx. type_of ( region_parent) . instantiate_identity ( ) , |r| {
865
- * r == ty:: ReEarlyBound ( region)
868
+ * r == ty:: ReEarlyParam ( region)
866
869
} ) ;
867
870
868
871
Some ( RegionName {
@@ -881,7 +884,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
881
884
& self ,
882
885
fr : RegionVid ,
883
886
) -> Option < RegionName > {
884
- let ty:: ReEarlyBound ( region) = * self . to_error_region ( fr) ? else {
887
+ let ty:: ReEarlyParam ( region) = * self . to_error_region ( fr) ? else {
885
888
return None ;
886
889
} ;
887
890
if region. has_name ( ) {
@@ -943,7 +946,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
943
946
& self ,
944
947
clauses : & [ ty:: Clause < ' tcx > ] ,
945
948
ty : Ty < ' tcx > ,
946
- region : ty:: EarlyBoundRegion ,
949
+ region : ty:: EarlyParamRegion ,
947
950
) -> bool {
948
951
let tcx = self . infcx . tcx ;
949
952
ty. walk ( ) . any ( |arg| {
@@ -956,7 +959,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
956
959
ty:: ClauseKind :: Projection ( data) if data. projection_ty . self_ty ( ) == ty => { }
957
960
_ => return false ,
958
961
}
959
- tcx. any_free_region_meets ( pred, |r| * r == ty:: ReEarlyBound ( region) )
962
+ tcx. any_free_region_meets ( pred, |r| * r == ty:: ReEarlyParam ( region) )
960
963
} )
961
964
} else {
962
965
false
0 commit comments