11use super :: {
2- CanonicalInput , Certainty , Goal , IsNormalizesToHack , NoSolution , QueryInput , QueryResult ,
2+ CandidateSource , CanonicalInput , Certainty , Goal , IsNormalizesToHack , NoSolution , QueryInput ,
3+ QueryResult ,
34} ;
45use crate :: ty;
56use format:: ProofTreeFormatter ;
67use std:: fmt:: { Debug , Write } ;
78
89mod format;
910
10- #[ derive( Eq , PartialEq , Debug , Hash , HashStable ) ]
11+ #[ derive( Debug , Eq , PartialEq ) ]
1112pub enum CacheHit {
1213 Provisional ,
1314 Global ,
1415}
1516
16- #[ derive( Eq , PartialEq , Hash , HashStable ) ]
17+ #[ derive( Eq , PartialEq ) ]
1718pub struct GoalEvaluation < ' tcx > {
1819 pub uncanonicalized_goal : Goal < ' tcx , ty:: Predicate < ' tcx > > ,
19- pub canonicalized_goal : CanonicalInput < ' tcx > ,
20-
21- pub kind : GoalEvaluationKind < ' tcx > ,
2220 pub is_normalizes_to_hack : IsNormalizesToHack ,
21+ pub evaluation : CanonicalGoalEvaluation < ' tcx > ,
2322 pub returned_goals : Vec < Goal < ' tcx , ty:: Predicate < ' tcx > > > ,
23+ }
2424
25+ #[ derive( Eq , PartialEq ) ]
26+ pub struct CanonicalGoalEvaluation < ' tcx > {
27+ pub goal : CanonicalInput < ' tcx > ,
28+ pub kind : GoalEvaluationKind < ' tcx > ,
2529 pub result : QueryResult < ' tcx > ,
2630}
2731
28- #[ derive( Eq , PartialEq , Hash , HashStable ) ]
32+ #[ derive( Eq , PartialEq ) ]
2933pub enum GoalEvaluationKind < ' tcx > {
34+ Overflow ,
3035 CacheHit ( CacheHit ) ,
3136 Uncached { revisions : Vec < GoalEvaluationStep < ' tcx > > } ,
3237}
@@ -36,55 +41,50 @@ impl Debug for GoalEvaluation<'_> {
3641 }
3742}
3843
39- #[ derive( Eq , PartialEq , Hash , HashStable ) ]
44+ #[ derive( Eq , PartialEq ) ]
4045pub struct AddedGoalsEvaluation < ' tcx > {
4146 pub evaluations : Vec < Vec < GoalEvaluation < ' tcx > > > ,
4247 pub result : Result < Certainty , NoSolution > ,
4348}
44- impl Debug for AddedGoalsEvaluation < ' _ > {
45- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
46- ProofTreeFormatter :: new ( f) . format_nested_goal_evaluation ( self )
47- }
48- }
4949
50- #[ derive( Eq , PartialEq , Hash , HashStable ) ]
50+ #[ derive( Eq , PartialEq ) ]
5151pub struct GoalEvaluationStep < ' tcx > {
5252 pub instantiated_goal : QueryInput < ' tcx , ty:: Predicate < ' tcx > > ,
5353
54- pub nested_goal_evaluations : Vec < AddedGoalsEvaluation < ' tcx > > ,
55- pub candidates : Vec < GoalCandidate < ' tcx > > ,
56-
57- pub result : QueryResult < ' tcx > ,
58- }
59- impl Debug for GoalEvaluationStep < ' _ > {
60- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
61- ProofTreeFormatter :: new ( f) . format_evaluation_step ( self )
62- }
54+ /// The actual evaluation of the goal, always `ProbeKind::Root`.
55+ pub evaluation : GoalCandidate < ' tcx > ,
6356}
6457
65- #[ derive( Eq , PartialEq , Hash , HashStable ) ]
58+ #[ derive( Eq , PartialEq ) ]
6659pub struct GoalCandidate < ' tcx > {
67- pub nested_goal_evaluations : Vec < AddedGoalsEvaluation < ' tcx > > ,
60+ pub added_goals_evaluations : Vec < AddedGoalsEvaluation < ' tcx > > ,
6861 pub candidates : Vec < GoalCandidate < ' tcx > > ,
69- pub kind : CandidateKind < ' tcx > ,
62+ pub kind : ProbeKind < ' tcx > ,
63+ }
64+
65+ impl Debug for GoalCandidate < ' _ > {
66+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
67+ ProofTreeFormatter :: new ( f) . format_candidate ( self )
68+ }
7069}
7170
72- #[ derive( Eq , PartialEq , Debug , Hash , HashStable ) ]
73- pub enum CandidateKind < ' tcx > {
71+ #[ derive( Debug , PartialEq , Eq ) ]
72+ pub enum ProbeKind < ' tcx > {
73+ /// The root inference context while proving a goal.
74+ Root { result : QueryResult < ' tcx > } ,
7475 /// Probe entered when normalizing the self ty during candidate assembly
7576 NormalizedSelfTyAssembly ,
76- /// A normal candidate for proving a goal
77- Candidate { name : String , result : QueryResult < ' tcx > } ,
77+ /// Some candidate to prove the current goal.
78+ ///
79+ /// FIXME: Remove this in favor of always using more strongly typed variants.
80+ MiscCandidate { name : & ' static str , result : QueryResult < ' tcx > } ,
81+ /// A candidate for proving a trait or alias-relate goal.
82+ TraitCandidate { source : CandidateSource , result : QueryResult < ' tcx > } ,
7883 /// Used in the probe that wraps normalizing the non-self type for the unsize
7984 /// trait, which is also structurally matched on.
8085 UnsizeAssembly ,
8186 /// During upcasting from some source object to target object type, used to
8287 /// do a probe to find out what projection type(s) may be used to prove that
8388 /// the source type upholds all of the target type's object bounds.
84- UpcastProbe ,
85- }
86- impl Debug for GoalCandidate < ' _ > {
87- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
88- ProofTreeFormatter :: new ( f) . format_candidate ( self )
89- }
89+ UpcastProjectionCompatibility ,
9090}
0 commit comments