about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-08-15 20:11:36 +0200
committerGitHub <noreply@github.com>2022-08-15 20:11:36 +0200
commita1fdea2b787c919596bbb4c5c12982decf45fbe9 (patch)
tree499f2ef906cffe718a62686c48db65c47c1d0192 /compiler
parente369ec871e7194ea3f97704651f08edd974c1135 (diff)
parentc436930f91a4befefa602f2d64d06fc9613d507b (diff)
downloadrust-a1fdea2b787c919596bbb4c5c12982decf45fbe9.tar.gz
rust-a1fdea2b787c919596bbb4c5c12982decf45fbe9.zip
Rollup merge of #100514 - compiler-errors:issue-100191, r=spastorino
Delay span bug when failing to normalize negative coherence impl subject due to other malformed impls

Fixes #100191

r? ``@spastorino``
Diffstat (limited to 'compiler')
-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 a54b36262b2..9bb41b900b8 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.