diff options
| author | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-08-30 21:50:22 -0400 |
|---|---|---|
| committer | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-09-13 20:18:49 -0400 |
| commit | aae37f87632dd74856d55c0cd45d2c192379c990 (patch) | |
| tree | f0547b334b687b6ad47d2eedbbab3ea4e85dd21a /compiler/rustc_borrowck/src/diagnostics | |
| parent | c75817b0a75d4b6b01ee10900ba5d01d4915e6a8 (diff) | |
| download | rust-aae37f87632dd74856d55c0cd45d2c192379c990.tar.gz rust-aae37f87632dd74856d55c0cd45d2c192379c990.zip | |
Use Predicate ConstraintCategory when normalizing
Diffstat (limited to 'compiler/rustc_borrowck/src/diagnostics')
| -rw-r--r-- | compiler/rustc_borrowck/src/diagnostics/region_errors.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index c276719c227..34be2874fcb 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -31,7 +31,7 @@ use crate::session_diagnostics::{ }; use super::{OutlivesSuggestionBuilder, RegionName}; -use crate::region_infer::BlameConstraint; +use crate::region_infer::{BlameConstraint, ExtraConstraintInfo}; use crate::{ nll::ConstraintDescription, region_infer::{values::RegionElement, TypeTest}, @@ -354,12 +354,11 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { ) { debug!("report_region_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr); - let BlameConstraint { category, cause, variance_info, .. } = self - .regioncx - .best_blame_constraint(fr, fr_origin, |r| { + let (blame_constraint, extra_info) = + self.regioncx.best_blame_constraint(fr, fr_origin, |r| { self.regioncx.provides_universal_region(r, fr, outlived_fr) - }) - .0; + }); + let BlameConstraint { category, cause, variance_info, .. } = blame_constraint; debug!("report_region_error: category={:?} {:?} {:?}", category, cause, variance_info); @@ -468,6 +467,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } } + for extra in extra_info { + match extra { + ExtraConstraintInfo::PlaceholderFromPredicate(span) => { + diag.span_note(span, format!("due to current limitations in the borrow checker, this implies a `'static` lifetime")); + } + } + } + self.buffer_error(diag); } @@ -559,6 +566,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { /// LL | ref_obj(x) /// | ^^^^^^^^^^ `x` escapes the function body here /// ``` + #[instrument(level = "debug", skip(self))] fn report_escaping_data_error( &self, errci: &ErrorConstraintInfo<'tcx>, |
