From c436930f91a4befefa602f2d64d06fc9613d507b Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 13 Aug 2022 22:04:50 +0000 Subject: Delay span bug when failing to normalize negative coherence impl subject due to other malformed impls --- compiler/rustc_trait_selection/src/traits/coherence.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_trait_selection/src/traits') diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index 8ab1aa65d3a..38e2500da9b 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -307,7 +307,13 @@ fn negative_impl<'cx, 'tcx>( tcx.impl_subject(impl1_def_id), ) { Ok(s) => s, - Err(err) => bug!("failed to fully normalize {:?}: {:?}", impl1_def_id, err), + Err(err) => { + tcx.sess.delay_span_bug( + tcx.def_span(impl1_def_id), + format!("failed to fully normalize {:?}: {:?}", impl1_def_id, err), + ); + return false; + } }; // Attempt to prove that impl2 applies, given all of the above. -- cgit 1.4.1-3-g733a5