Skip to content

new solver: make all goal evaluation able to be automatically rerun #108896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 21, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add assert
  • Loading branch information
BoxyUwU committed Mar 17, 2023
commit ea08d3a47cee34f9943a2ca850ac7b3435fb499e
11 changes: 9 additions & 2 deletions compiler/rustc_trait_selection/src/solve/mod.rs
Original file line number Diff line number Diff line change
@@ -78,15 +78,22 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
) -> Result<(bool, Certainty), NoSolution> {
let mut search_graph = search_graph::SearchGraph::new(self.tcx);

let result = EvalCtxt {
let mut ecx = EvalCtxt {
search_graph: &mut search_graph,
infcx: self,
// Only relevant when canonicalizing the response.
max_input_universe: ty::UniverseIndex::ROOT,
var_values: CanonicalVarValues::dummy(),
nested_goals: NestedGoals::new(),
};
let result = ecx.evaluate_goal(IsNormalizesToHack::No, goal);

if let Ok((_, Certainty::Yes)) = result {
assert!(
ecx.nested_goals.is_empty(),
"Cannot be certain of query response if unevaluated goals exist"
);
}
.evaluate_goal(IsNormalizesToHack::No, goal);

assert!(search_graph.is_empty());
result