summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>2022-04-12 23:16:59 +0200
committerGitHub <noreply@github.com>2022-04-12 23:16:59 +0200
commit91813a7175dacce03be33ba63c7abbdea3da1748 (patch)
treeb5b403fe47641f67dd2952fe5c2be68756ab3c10 /compiler/rustc_resolve/src
parent6aa875aa9629b985638984b32a8adfb46da9ee66 (diff)
parent285b9d1cd4e170f6a6c98cbdf5f5059b52735d01 (diff)
downloadrust-91813a7175dacce03be33ba63c7abbdea3da1748.tar.gz
rust-91813a7175dacce03be33ba63c7abbdea3da1748.zip
Rollup merge of #95918 - compiler-errors:issue-95878, r=cjgillot
Delay a bug when we see SelfCtor in ref pattern

Fixes #95878
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/late.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs
index 9084e659ae4..f27b60e889f 100644
--- a/compiler/rustc_resolve/src/late.rs
+++ b/compiler/rustc_resolve/src/late.rs
@@ -1888,6 +1888,15 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
                 // These entities are explicitly allowed to be shadowed by fresh bindings.
                 None
             }
+            Res::SelfCtor(_) => {
+                // We resolve `Self` in pattern position as an ident sometimes during recovery,
+                // so delay a bug instead of ICEing.
+                self.r.session.delay_span_bug(
+                    ident.span,
+                    "unexpected `SelfCtor` in pattern, expected identifier"
+                );
+                None
+            }
             _ => span_bug!(
                 ident.span,
                 "unexpected resolution for an identifier in pattern: {:?}",