@@ -254,6 +254,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
254
254
/// *user* has a name for. In that case, we'll be able to map
255
255
/// `fr` to a `Region<'tcx>`, and that region will be one of
256
256
/// named variants.
257
+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
257
258
fn give_name_from_error_region ( & self , fr : RegionVid ) -> Option < RegionName > {
258
259
let error_region = self . to_error_region ( fr) ?;
259
260
@@ -290,7 +291,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
290
291
if free_region. bound_region . is_named ( ) {
291
292
// A named region that is actually named.
292
293
Some ( RegionName { name, source : RegionNameSource :: NamedFreeRegion ( span) } )
293
- } else {
294
+ } else if let hir :: IsAsync :: Async = tcx . asyncness ( self . mir_hir_id ( ) . owner ) {
294
295
// If we spuriously thought that the region is named, we should let the
295
296
// system generate a true name for error messages. Currently this can
296
297
// happen if we have an elided name in an async fn for example: the
@@ -301,6 +302,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
301
302
name,
302
303
source : RegionNameSource :: AnonRegionFromAsyncFn ( span) ,
303
304
} )
305
+ } else {
306
+ None
304
307
}
305
308
}
306
309
@@ -362,6 +365,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
362
365
/// | fn foo(x: &u32) { .. }
363
366
/// ------- fully elaborated type of `x` is `&'1 u32`
364
367
/// ```
368
+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
365
369
fn give_name_if_anonymous_region_appears_in_arguments (
366
370
& self ,
367
371
fr : RegionVid ,
@@ -651,6 +655,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
651
655
/// | let x = Some(&22);
652
656
/// - fully elaborated type of `x` is `Option<&'1 u32>`
653
657
/// ```
658
+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
654
659
fn give_name_if_anonymous_region_appears_in_upvars ( & self , fr : RegionVid ) -> Option < RegionName > {
655
660
let upvar_index = self . regioncx . get_upvar_index_for_region ( self . infcx . tcx , fr) ?;
656
661
let ( upvar_name, upvar_span) = self . regioncx . get_upvar_name_and_span_for_region (
@@ -670,6 +675,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
670
675
/// must be a closure since, in a free fn, such an argument would
671
676
/// have to either also appear in an argument (if using elision)
672
677
/// or be early bound (named, not in argument).
678
+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
673
679
fn give_name_if_anonymous_region_appears_in_output ( & self , fr : RegionVid ) -> Option < RegionName > {
674
680
let tcx = self . infcx . tcx ;
675
681
let hir = tcx. hir ( ) ;
@@ -801,6 +807,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
801
807
}
802
808
}
803
809
810
+ #[ tracing:: instrument( level = "trace" , skip( self ) ) ]
804
811
fn give_name_if_anonymous_region_appears_in_yield_ty (
805
812
& self ,
806
813
fr : RegionVid ,
0 commit comments