diff options
| author | Michael Goulet <michael@errs.io> | 2023-04-20 18:40:34 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-04-20 18:40:34 +0000 |
| commit | 3206100ed9273c1adcc661d30db460c2402d568c (patch) | |
| tree | 888a0cfc56391070999dac3ab5644a1207708c3f | |
| parent | 4fd7739aac547f99b5f0378ee1b6752258d234f7 (diff) | |
| download | rust-3206100ed9273c1adcc661d30db460c2402d568c.tar.gz rust-3206100ed9273c1adcc661d30db460c2402d568c.zip | |
Result is just bool but special
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/eval_ctxt.rs | 11 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs | 5 |
2 files changed, 9 insertions, 7 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs index 4c79445d345..bd52957d162 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs @@ -62,8 +62,9 @@ pub struct EvalCtxt<'a, 'tcx> { // // If so, then it can no longer be used to make a canonical query response, // since subsequent calls to `try_evaluate_added_goals` have possibly dropped - // ambiguous goals. Instead, use a probe. - tainted: bool, + // ambiguous goals. Instead, a probe needs to be introduced somewhere in the + // evaluation code. + tainted: Result<(), NoSolution>, } #[derive(Debug, Copy, Clone, PartialEq, Eq)] @@ -128,7 +129,7 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> { max_input_universe: ty::UniverseIndex::ROOT, var_values: CanonicalVarValues::dummy(), nested_goals: NestedGoals::new(), - tainted: false, + tainted: Ok(()), }; let result = ecx.evaluate_goal(IsNormalizesToHack::No, goal); @@ -180,7 +181,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { max_input_universe: canonical_goal.max_universe, search_graph, nested_goals: NestedGoals::new(), - tainted: false, + tainted: Ok(()), }; ecx.compute_goal(goal) }) @@ -401,7 +402,7 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { ); if response.is_err() { - self.tainted = true; + self.tainted = Err(NoSolution); } self.nested_goals = goals; diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs index e7a6282cb3d..2dea36811d8 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs @@ -51,8 +51,9 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { certainty: Certainty, ) -> QueryResult<'tcx> { let goals_certainty = self.try_evaluate_added_goals()?; - assert!( - !self.tainted, + assert_eq!( + self.tainted, + Ok(()), "EvalCtxt is tainted -- nested goals may have been dropped in a \ previous call to `try_evaluate_added_goals!`" ); |
