diff options
| author | Boxy <supbscripter@gmail.com> | 2023-03-17 13:37:47 +0000 |
|---|---|---|
| committer | Boxy <supbscripter@gmail.com> | 2023-03-17 13:37:47 +0000 |
| commit | ea08d3a47cee34f9943a2ca850ac7b3435fb499e (patch) | |
| tree | f97ea1fa6ca461fd42a1b217370a93553a7012a2 | |
| parent | ee31e5fc57499cd7a97b7e0564425324b0186688 (diff) | |
| download | rust-ea08d3a47cee34f9943a2ca850ac7b3435fb499e.tar.gz rust-ea08d3a47cee34f9943a2ca850ac7b3435fb499e.zip | |
add assert
| -rw-r--r-- | compiler/rustc_trait_selection/src/solve/mod.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/mod.rs b/compiler/rustc_trait_selection/src/solve/mod.rs index 089c5f8fb4d..ba68ff1c2e3 100644 --- a/compiler/rustc_trait_selection/src/solve/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/mod.rs @@ -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 |
