diff options
| author | Boxy <supbscripter@gmail.com> | 2023-06-08 23:58:34 +0100 |
|---|---|---|
| committer | Boxy <supbscripter@gmail.com> | 2023-06-19 09:06:16 +0100 |
| commit | 51090b962f10a178f9e15ef445692f6732c9c7ce (patch) | |
| tree | 3c64667dbd599d95f538ae5867e74b223a69c995 /compiler/rustc_middle/src | |
| parent | e367c04dc6b23cc09d3bed448450a6c5d19dd254 (diff) | |
show normalizes-to hack and response instantiation goals
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/traits/solve/inspect.rs | 24 |
2 files changed, 28 insertions, 2 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index f0380204970..73959038582 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -991,3 +991,9 @@ pub enum DefiningAnchor { /// Used to catch type mismatch errors when handling opaque types. Error, } + +#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, HashStable)] +pub enum IsNormalizesToHack { + Yes, + No, +} diff --git a/compiler/rustc_middle/src/traits/solve/inspect.rs b/compiler/rustc_middle/src/traits/solve/inspect.rs index 0379833d503..d0091d1c30f 100644 --- a/compiler/rustc_middle/src/traits/solve/inspect.rs +++ b/compiler/rustc_middle/src/traits/solve/inspect.rs @@ -1,5 +1,5 @@ use super::{CanonicalInput, Certainty, Goal, NoSolution, QueryInput, QueryResult}; -use crate::ty; +use crate::{traits::IsNormalizesToHack, ty}; use std::fmt::{Debug, Write}; #[derive(Eq, PartialEq, Debug, Hash, HashStable)] @@ -14,6 +14,8 @@ pub struct GoalEvaluation<'tcx> { pub canonicalized_goal: CanonicalInput<'tcx>, pub kind: GoalEvaluationKind<'tcx>, + pub is_normalizes_to_hack: IsNormalizesToHack, + pub returned_goals: Vec<Goal<'tcx, ty::Predicate<'tcx>>>, pub result: QueryResult<'tcx>, } @@ -99,7 +101,13 @@ impl ProofTreeFormatter<'_, '_> { fn format_goal_evaluation(&mut self, goal: &GoalEvaluation<'_>) -> std::fmt::Result { let f = &mut *self.f; - writeln!(f, "GOAL: {:?}", goal.uncanonicalized_goal)?; + + let goal_text = match goal.is_normalizes_to_hack { + IsNormalizesToHack::Yes => "NORMALIZES-TO HACK GOAL", + IsNormalizesToHack::No => "GOAL", + }; + + writeln!(f, "{}: {:?}", goal_text, goal.uncanonicalized_goal,)?; writeln!(f, "CANONICALIZED: {:?}", goal.canonicalized_goal)?; match &goal.kind { @@ -120,7 +128,19 @@ impl ProofTreeFormatter<'_, '_> { let f = &mut *self.f; writeln!(f, "RESULT: {:?}", goal.result) } + }?; + + if goal.returned_goals.len() > 0 { + let f = &mut *self.f; + writeln!(f, "NESTED GOALS ADDED TO CALLER: [")?; + let mut f = self.nested(); + for goal in goal.returned_goals.iter() { + writeln!(f, "ADDED GOAL: {:?},", goal)?; + } + writeln!(self.f, "]")?; } + + Ok(()) } fn format_evaluation_step( |
