From 55bf8108217e300e977b81504316c564f4a5c3d5 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 5 Aug 2023 20:09:31 +0000 Subject: [PATCH] Also report when goals go from ok to error --- compiler/rustc_trait_selection/src/solve/eval_ctxt.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs index 5ec9ddfe64aee..60c49f665a6a9 100644 --- a/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs +++ b/compiler/rustc_trait_selection/src/solve/eval_ctxt.rs @@ -391,13 +391,19 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> { debug!("rerunning goal to check result is stable"); self.search_graph.reset_encountered_overflow(encountered_overflow); let (_orig_values, canonical_goal) = self.canonicalize_goal(goal); - let new_canonical_response = EvalCtxt::evaluate_canonical_goal( + let Ok(new_canonical_response) = EvalCtxt::evaluate_canonical_goal( self.tcx(), self.search_graph, canonical_goal, // FIXME(-Ztrait-solver=next): we do not track what happens in `evaluate_canonical_goal` &mut ProofTreeBuilder::new_noop(), - )?; + ) else { + bug!( + "goal went from {certainty:?} to error: re-canonicalized goal={canonical_goal:#?} \ + first_response={canonical_response:#?}, + second response was error" + ); + }; // We only check for modulo regions as we convert all regions in // the input to new existentials, even if they're expected to be // `'static` or a placeholder region.