diff options
| author | Michael Goulet <michael@errs.io> | 2024-04-29 11:16:21 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-04-29 17:06:34 -0400 |
| commit | 13825dcc156ee848dcbd57f3c118e864fc158c56 (patch) | |
| tree | 36d220b749ee2a11a36e42cfbe66c758a7853ae3 /compiler/rustc_trait_selection/src | |
| parent | a8a1d3a771850e1e364eb9010e98789ce758a817 (diff) | |
| download | rust-13825dcc156ee848dcbd57f3c118e864fc158c56.tar.gz rust-13825dcc156ee848dcbd57f3c118e864fc158c56.zip | |
Take proof trees by value in inspect goal
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/inspect/analyse.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs index 2d58111e803..45b0e8d2eb2 100644 --- a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs +++ b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs @@ -34,9 +34,9 @@ pub struct InspectConfig { pub struct InspectGoal<'a, 'tcx> { infcx: &'a InferCtxt<'tcx>, depth: usize, - orig_values: &'a [ty::GenericArg<'tcx>], + orig_values: Vec<ty::GenericArg<'tcx>>, goal: Goal<'tcx, ty::Predicate<'tcx>>, - evaluation: &'a inspect::GoalEvaluation<'tcx>, + evaluation: inspect::CanonicalGoalEvaluation<'tcx>, } pub struct InspectCandidate<'a, 'tcx> { @@ -139,7 +139,7 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> { try_visit!(visitor.visit_goal(&InspectGoal::new( infcx, self.goal.depth + 1, - &proof_tree.unwrap(), + proof_tree.unwrap(), ))); } } @@ -164,7 +164,7 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> { } pub fn result(&self) -> Result<Certainty, NoSolution> { - self.evaluation.evaluation.result.map(|c| c.value.certainty) + self.evaluation.result.map(|c| c.value.certainty) } fn candidates_recur( @@ -221,7 +221,7 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> { pub fn candidates(&'a self) -> Vec<InspectCandidate<'a, 'tcx>> { let mut candidates = vec![]; - let last_eval_step = match self.evaluation.evaluation.kind { + let last_eval_step = match self.evaluation.kind { inspect::CanonicalGoalEvaluationKind::Overflow | inspect::CanonicalGoalEvaluationKind::CycleInStack | inspect::CanonicalGoalEvaluationKind::ProvisionalCacheHit => { @@ -254,18 +254,15 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> { candidates.pop().filter(|_| candidates.is_empty()) } - fn new( - infcx: &'a InferCtxt<'tcx>, - depth: usize, - root: &'a inspect::GoalEvaluation<'tcx>, - ) -> Self { - match root.kind { - inspect::GoalEvaluationKind::Root { ref orig_values } => InspectGoal { + fn new(infcx: &'a InferCtxt<'tcx>, depth: usize, root: inspect::GoalEvaluation<'tcx>) -> Self { + let inspect::GoalEvaluation { uncanonicalized_goal, kind, evaluation } = root; + match kind { + inspect::GoalEvaluationKind::Root { orig_values } => InspectGoal { infcx, depth, orig_values, - goal: root.uncanonicalized_goal.fold_with(&mut EagerResolver::new(infcx)), - evaluation: root, + goal: uncanonicalized_goal.fold_with(&mut EagerResolver::new(infcx)), + evaluation, }, inspect::GoalEvaluationKind::Nested { .. } => unreachable!(), } @@ -294,6 +291,6 @@ impl<'tcx> InferCtxt<'tcx> { ) -> V::Result { let (_, proof_tree) = self.evaluate_root_goal(goal, GenerateProofTree::Yes); let proof_tree = proof_tree.unwrap(); - visitor.visit_goal(&InspectGoal::new(self, 0, &proof_tree)) + visitor.visit_goal(&InspectGoal::new(self, 0, proof_tree)) } } |
