diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-05-13 19:08:57 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-06-19 23:30:43 +0200 |
| commit | 4b79b8bfa139ca5f991aa08b405003f748d3caf6 (patch) | |
| tree | dc0d43c5dba03b773589b5b1eb333b274da4088d /compiler/rustc_borrowck/src | |
| parent | bc6a2c11ee34b46a1e2863a8522b6f7c2e4481c3 (diff) | |
| download | rust-4b79b8bfa139ca5f991aa08b405003f748d3caf6.tar.gz rust-4b79b8bfa139ca5f991aa08b405003f748d3caf6.zip | |
Only use special async fn case for actual async fns in borrowck diagnostics.
Diffstat (limited to 'compiler/rustc_borrowck/src')
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/region_name.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index d6b5089712a..1db4b902f71 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -254,6 +254,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { /// *user* has a name for. In that case, we'll be able to map /// `fr` to a `Region<'tcx>`, and that region will be one of /// named variants. + #[tracing::instrument(level = "trace", skip(self))] fn give_name_from_error_region(&self, fr: RegionVid) -> Option<RegionName> { let error_region = self.to_error_region(fr)?; @@ -290,7 +291,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { if free_region.bound_region.is_named() { // A named region that is actually named. Some(RegionName { name, source: RegionNameSource::NamedFreeRegion(span) }) - } else { + } else if let hir::IsAsync::Async = tcx.asyncness(self.mir_hir_id().owner) { // If we spuriously thought that the region is named, we should let the // system generate a true name for error messages. Currently this can // happen if we have an elided name in an async fn for example: the @@ -301,6 +302,8 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { name, source: RegionNameSource::AnonRegionFromAsyncFn(span), }) + } else { + None } } @@ -362,6 +365,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { /// | fn foo(x: &u32) { .. } /// ------- fully elaborated type of `x` is `&'1 u32` /// ``` + #[tracing::instrument(level = "trace", skip(self))] fn give_name_if_anonymous_region_appears_in_arguments( &self, fr: RegionVid, @@ -651,6 +655,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { /// | let x = Some(&22); /// - fully elaborated type of `x` is `Option<&'1 u32>` /// ``` + #[tracing::instrument(level = "trace", skip(self))] fn give_name_if_anonymous_region_appears_in_upvars(&self, fr: RegionVid) -> Option<RegionName> { let upvar_index = self.regioncx.get_upvar_index_for_region(self.infcx.tcx, fr)?; let (upvar_name, upvar_span) = self.regioncx.get_upvar_name_and_span_for_region( @@ -670,6 +675,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { /// must be a closure since, in a free fn, such an argument would /// have to either also appear in an argument (if using elision) /// or be early bound (named, not in argument). + #[tracing::instrument(level = "trace", skip(self))] fn give_name_if_anonymous_region_appears_in_output(&self, fr: RegionVid) -> Option<RegionName> { let tcx = self.infcx.tcx; let hir = tcx.hir(); @@ -801,6 +807,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { } } + #[tracing::instrument(level = "trace", skip(self))] fn give_name_if_anonymous_region_appears_in_yield_ty( &self, fr: RegionVid, |
