@@ -23,14 +23,14 @@ pub(crate) struct RegionName {
2323}
2424
2525/// 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`.
2727/// This helps to print the right kinds of diagnostics.
2828#[ derive( Debug , Clone ) ]
2929pub ( crate ) enum RegionNameSource {
3030 /// A bound (not free) region that was instantiated at the def site (not an HRTB).
31- NamedEarlyBoundRegion ( Span ) ,
31+ NamedEarlyParamRegion ( Span ) ,
3232 /// A free region that the user has a name (`'a`) for.
33- NamedFreeRegion ( Span ) ,
33+ NamedLateParamRegion ( Span ) ,
3434 /// The `'static` region.
3535 Static ,
3636 /// The free region corresponding to the environment of a closure.
@@ -69,8 +69,8 @@ pub(crate) enum RegionNameHighlight {
6969impl RegionName {
7070 pub ( crate ) fn was_named ( & self ) -> bool {
7171 match self . source {
72- RegionNameSource :: NamedEarlyBoundRegion ( ..)
73- | RegionNameSource :: NamedFreeRegion ( ..)
72+ RegionNameSource :: NamedEarlyParamRegion ( ..)
73+ | RegionNameSource :: NamedLateParamRegion ( ..)
7474 | RegionNameSource :: Static => true ,
7575 RegionNameSource :: SynthesizedFreeEnvRegion ( ..)
7676 | RegionNameSource :: AnonRegionFromArgument ( ..)
@@ -85,8 +85,8 @@ impl RegionName {
8585 pub ( crate ) fn span ( & self ) -> Option < Span > {
8686 match self . source {
8787 RegionNameSource :: Static => None ,
88- RegionNameSource :: NamedEarlyBoundRegion ( span)
89- | RegionNameSource :: NamedFreeRegion ( span)
88+ RegionNameSource :: NamedEarlyParamRegion ( span)
89+ | RegionNameSource :: NamedLateParamRegion ( span)
9090 | RegionNameSource :: SynthesizedFreeEnvRegion ( span, _)
9191 | RegionNameSource :: AnonRegionFromUpvar ( span, _)
9292 | RegionNameSource :: AnonRegionFromYieldTy ( span, _)
@@ -104,8 +104,8 @@ impl RegionName {
104104
105105 pub ( crate ) fn highlight_region_name ( & self , diag : & mut Diagnostic ) {
106106 match & self . source {
107- RegionNameSource :: NamedFreeRegion ( span)
108- | RegionNameSource :: NamedEarlyBoundRegion ( span) => {
107+ RegionNameSource :: NamedLateParamRegion ( span)
108+ | RegionNameSource :: NamedEarlyParamRegion ( span) => {
109109 diag. span_label ( * span, format ! ( "lifetime `{self}` defined here" ) ) ;
110110 }
111111 RegionNameSource :: SynthesizedFreeEnvRegion ( span, note) => {
@@ -280,28 +280,31 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
280280
281281 debug ! ( "give_region_a_name: error_region = {:?}" , error_region) ;
282282 match * error_region {
283- ty:: ReEarlyBound ( ebr) => ebr. has_name ( ) . then ( || {
283+ ty:: ReEarlyParam ( ebr) => ebr. has_name ( ) . then ( || {
284284 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) }
286286 } ) ,
287287
288288 ty:: ReStatic => {
289289 Some ( RegionName { name : kw:: StaticLifetime , source : RegionNameSource :: Static } )
290290 }
291291
292- ty:: ReFree ( free_region ) => match free_region . bound_region {
292+ ty:: ReLateParam ( late_param ) => match late_param . bound_region {
293293 ty:: BoundRegionKind :: BrNamed ( region_def_id, name) => {
294294 // Get the span to point to, even if we don't use the name.
295295 let span = tcx. hir ( ) . span_if_local ( region_def_id) . unwrap_or ( DUMMY_SP ) ;
296296 debug ! (
297297 "bound region named: {:?}, is_named: {:?}" ,
298298 name,
299- free_region . bound_region. is_named( )
299+ late_param . bound_region. is_named( )
300300 ) ;
301301
302- if free_region . bound_region . is_named ( ) {
302+ if late_param . bound_region . is_named ( ) {
303303 // 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+ } )
305308 } else if tcx. asyncness ( self . mir_hir_id ( ) . owner ) . is_async ( ) {
306309 // If we spuriously thought that the region is named, we should let the
307310 // system generate a true name for error messages. Currently this can
@@ -847,7 +850,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
847850 & self ,
848851 fr : RegionVid ,
849852 ) -> Option < RegionName > {
850- let ty:: ReEarlyBound ( region) = * self . to_error_region ( fr) ? else {
853+ let ty:: ReEarlyParam ( region) = * self . to_error_region ( fr) ? else {
851854 return None ;
852855 } ;
853856 if region. has_name ( ) {
@@ -862,7 +865,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
862865
863866 let found = tcx
864867 . any_free_region_meets ( & tcx. type_of ( region_parent) . instantiate_identity ( ) , |r| {
865- * r == ty:: ReEarlyBound ( region)
868+ * r == ty:: ReEarlyParam ( region)
866869 } ) ;
867870
868871 Some ( RegionName {
@@ -881,7 +884,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
881884 & self ,
882885 fr : RegionVid ,
883886 ) -> Option < RegionName > {
884- let ty:: ReEarlyBound ( region) = * self . to_error_region ( fr) ? else {
887+ let ty:: ReEarlyParam ( region) = * self . to_error_region ( fr) ? else {
885888 return None ;
886889 } ;
887890 if region. has_name ( ) {
@@ -943,7 +946,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
943946 & self ,
944947 clauses : & [ ty:: Clause < ' tcx > ] ,
945948 ty : Ty < ' tcx > ,
946- region : ty:: EarlyBoundRegion ,
949+ region : ty:: EarlyParamRegion ,
947950 ) -> bool {
948951 let tcx = self . infcx . tcx ;
949952 ty. walk ( ) . any ( |arg| {
@@ -956,7 +959,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
956959 ty:: ClauseKind :: Projection ( data) if data. projection_ty . self_ty ( ) == ty => { }
957960 _ => return false ,
958961 }
959- tcx. any_free_region_meets ( pred, |r| * r == ty:: ReEarlyBound ( region) )
962+ tcx. any_free_region_meets ( pred, |r| * r == ty:: ReEarlyParam ( region) )
960963 } )
961964 } else {
962965 false
0 commit comments