Skip to content

Commit ea08d3a

Browse files
committed
add assert
1 parent ee31e5f commit ea08d3a

File tree

1 file changed

+9
-2
lines changed
  • compiler/rustc_trait_selection/src/solve

1 file changed

+9
-2
lines changed

compiler/rustc_trait_selection/src/solve/mod.rs

+9-2
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,22 @@ impl<'tcx> InferCtxtEvalExt<'tcx> for InferCtxt<'tcx> {
7878
) -> Result<(bool, Certainty), NoSolution> {
7979
let mut search_graph = search_graph::SearchGraph::new(self.tcx);
8080

81-
let result = EvalCtxt {
81+
let mut ecx = EvalCtxt {
8282
search_graph: &mut search_graph,
8383
infcx: self,
8484
// Only relevant when canonicalizing the response.
8585
max_input_universe: ty::UniverseIndex::ROOT,
8686
var_values: CanonicalVarValues::dummy(),
8787
nested_goals: NestedGoals::new(),
88+
};
89+
let result = ecx.evaluate_goal(IsNormalizesToHack::No, goal);
90+
91+
if let Ok((_, Certainty::Yes)) = result {
92+
assert!(
93+
ecx.nested_goals.is_empty(),
94+
"Cannot be certain of query response if unevaluated goals exist"
95+
);
8896
}
89-
.evaluate_goal(IsNormalizesToHack::No, goal);
9097

9198
assert!(search_graph.is_empty());
9299
result

0 commit comments

Comments
 (0)