diff options
| author | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-09-16 09:01:28 -0400 |
|---|---|---|
| committer | Jack Huey <31162821+jackh726@users.noreply.github.com> | 2022-09-16 09:01:28 -0400 |
| commit | bba514b7b4f3062139d17ce1e4ab26b396c8ad49 (patch) | |
| tree | 9ef5520b53828c4e6e63383023642ffc75ebaeaf /compiler/rustc_borrowck/src | |
| parent | df34db9b032b15efd86df3544cc75e6d55dc492e (diff) | |
| download | rust-bba514b7b4f3062139d17ce1e4ab26b396c8ad49.tar.gz rust-bba514b7b4f3062139d17ce1e4ab26b396c8ad49.zip | |
Revert "Use Predicate ConstraintCategory when normalizing"
This reverts commit aae37f87632dd74856d55c0cd45d2c192379c990.
Diffstat (limited to 'compiler/rustc_borrowck/src')
4 files changed, 14 insertions, 37 deletions
diff --git a/compiler/rustc_borrowck/src/constraints/mod.rs b/compiler/rustc_borrowck/src/constraints/mod.rs index df04128135b..6d323b03cda 100644 --- a/compiler/rustc_borrowck/src/constraints/mod.rs +++ b/compiler/rustc_borrowck/src/constraints/mod.rs @@ -21,7 +21,10 @@ pub(crate) struct OutlivesConstraintSet<'tcx> { impl<'tcx> OutlivesConstraintSet<'tcx> { pub(crate) fn push(&mut self, constraint: OutlivesConstraint<'tcx>) { - debug!("OutlivesConstraintSet::push({:?})", constraint); + debug!( + "OutlivesConstraintSet::push({:?}: {:?} @ {:?}", + constraint.sup, constraint.sub, constraint.locations + ); if constraint.sup == constraint.sub { // 'a: 'a is pretty uninteresting return; diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 34be2874fcb..c276719c227 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, ExtraConstraintInfo}; +use crate::region_infer::BlameConstraint; use crate::{ nll::ConstraintDescription, region_infer::{values::RegionElement, TypeTest}, @@ -354,11 +354,12 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { ) { debug!("report_region_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr); - let (blame_constraint, extra_info) = - self.regioncx.best_blame_constraint(fr, fr_origin, |r| { + let BlameConstraint { category, cause, variance_info, .. } = self + .regioncx + .best_blame_constraint(fr, fr_origin, |r| { self.regioncx.provides_universal_region(r, fr, outlived_fr) - }); - let BlameConstraint { category, cause, variance_info, .. } = blame_constraint; + }) + .0; debug!("report_region_error: category={:?} {:?} {:?}", category, cause, variance_info); @@ -467,14 +468,6 @@ 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); } @@ -566,7 +559,6 @@ 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>, diff --git a/compiler/rustc_borrowck/src/type_check/canonical.rs b/compiler/rustc_borrowck/src/type_check/canonical.rs index 9271a2f4dc7..8a3972a12c5 100644 --- a/compiler/rustc_borrowck/src/type_check/canonical.rs +++ b/compiler/rustc_borrowck/src/type_check/canonical.rs @@ -104,7 +104,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { ); } - #[instrument(level = "debug", skip(self))] pub(super) fn normalize_and_prove_instantiated_predicates( &mut self, // Keep this parameter for now, in case we start using @@ -119,9 +118,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { .zip(instantiated_predicates.spans.into_iter()) { debug!(?predicate); - let category = ConstraintCategory::Predicate(span); - let predicate = self.normalize_with_category(predicate, locations, category); - self.prove_predicate(predicate, locations, category); + let predicate = self.normalize(predicate, locations); + self.prove_predicate(predicate, locations, ConstraintCategory::Predicate(span)); } } @@ -157,27 +155,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { }) } - pub(super) fn normalize<T>(&mut self, value: T, location: impl NormalizeLocation) -> T - where - T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx, - { - self.normalize_with_category(value, location, ConstraintCategory::Boring) - } - #[instrument(skip(self), level = "debug")] - pub(super) fn normalize_with_category<T>( - &mut self, - value: T, - location: impl NormalizeLocation, - category: ConstraintCategory<'tcx>, - ) -> T + pub(super) fn normalize<T>(&mut self, value: T, location: impl NormalizeLocation) -> T where T: type_op::normalize::Normalizable<'tcx> + fmt::Display + Copy + 'tcx, { let param_env = self.param_env; self.fully_perform_op( location.to_locations(), - category, + ConstraintCategory::Boring, param_env.and(type_op::normalize::Normalize::new(value)), ) .unwrap_or_else(|NoSolution| { diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index f41d70d384d..5f714cf723b 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -312,8 +312,6 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'tcx> { } fn visit_constant(&mut self, constant: &Constant<'tcx>, location: Location) { - debug!(?constant, ?location, "visit_constant"); - self.super_constant(constant, location); let ty = self.sanitize_type(constant, constant.literal.ty()); @@ -1813,8 +1811,6 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { } fn check_operand(&mut self, op: &Operand<'tcx>, location: Location) { - debug!(?op, ?location, "check_operand"); - if let Operand::Constant(constant) = op { let maybe_uneval = match constant.literal { ConstantKind::Ty(ct) => match ct.kind() { |
