about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_trait_selection/src/solve/mod.rs11
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