about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-04-05 16:38:49 +0200
committerGitHub <noreply@github.com>2024-04-05 16:38:49 +0200
commitcb6a1c8d455a26c82165e3285557da2d82e22385 (patch)
tree9f00123776f8858ce54a689016193e9507eb063a /compiler/rustc_trait_selection/src/traits/specialize/mod.rs
parent8873ca57f8646328bf0a10ee94918c8c597706e9 (diff)
parent5333f2a9d156a8c1934da11c505dc91a29f5db08 (diff)
downloadrust-cb6a1c8d455a26c82165e3285557da2d82e22385.tar.gz
rust-cb6a1c8d455a26c82165e3285557da2d82e22385.zip
Rollup merge of #122894 - compiler-errors:downgrade, r=lcnr
Move check for error in impl header outside of reporting

Fixes #121006

r? lcnr

test location kinda sucks, can move it if needed
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits/specialize/mod.rs')
-rw-r--r--compiler/rustc_trait_selection/src/traits/specialize/mod.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
index ab8d7d31e43..46a0a4eb5ef 100644
--- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
+++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs
@@ -407,10 +407,6 @@ fn report_conflicting_impls<'tcx>(
         impl_span: Span,
         err: &mut Diag<'_, G>,
     ) {
-        if (overlap.trait_ref, overlap.self_ty).references_error() {
-            err.downgrade_to_delayed_bug();
-        }
-
         match tcx.span_of_impl(overlap.with_impl) {
             Ok(span) => {
                 err.span_label(span, "first implementation here");
@@ -463,6 +459,11 @@ fn report_conflicting_impls<'tcx>(
         )
     });
 
+    // Don't report overlap errors if the header references error
+    if let Err(err) = (overlap.trait_ref, overlap.self_ty).error_reported() {
+        return Err(err);
+    }
+
     match used_to_be_allowed {
         None => {
             let reported = if overlap.with_impl.is_local()