Result is just bool but special
This commit is contained in:
parent
4fd7739aac
commit
3206100ed9
@ -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 @@ fn evaluate_root_goal(
|
||||
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 @@ fn evaluate_canonical_goal(
|
||||
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 @@ pub(super) fn try_evaluate_added_goals(&mut self) -> Result<Certainty, NoSolutio
|
||||
);
|
||||
|
||||
if response.is_err() {
|
||||
self.tainted = true;
|
||||
self.tainted = Err(NoSolution);
|
||||
}
|
||||
|
||||
self.nested_goals = goals;
|
||||
|
@ -51,8 +51,9 @@ pub(in crate::solve) fn evaluate_added_goals_and_make_canonical_response(
|
||||
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!`"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user