about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-08-13 22:04:50 +0000
committerMichael Goulet <michael@errs.io>2022-08-13 22:11:42 +0000
commitc436930f91a4befefa602f2d64d06fc9613d507b (patch)
tree26b6b133c54ecb148de867e05c13d4134358a89a /compiler/rustc_trait_selection
parent75b7e52e92c3b00fc891b47f5b2efdff0a2be55a (diff)
downloadrust-c436930f91a4befefa602f2d64d06fc9613d507b.tar.gz
rust-c436930f91a4befefa602f2d64d06fc9613d507b.zip
Delay span bug when failing to normalize negative coherence impl subject due to other malformed impls
Diffstat (limited to 'compiler/rustc_trait_selection')
-rw-r--r--compiler/rustc_trait_selection/src/traits/coherence.rs8
1 files changed, 7 insertions, 1 deletions
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.