about summary refs log tree commit diff
path: root/src/test/ui/pattern
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-04-10 20:55:10 -0700
committerMichael Goulet <michael@errs.io>2022-04-10 20:55:10 -0700
commit285b9d1cd4e170f6a6c98cbdf5f5059b52735d01 (patch)
treef622e50c35928a15dc50200dec71734c2729879f /src/test/ui/pattern
parent18f32b73bdb3833c18c73fe3062bde8e1721ccca (diff)
downloadrust-285b9d1cd4e170f6a6c98cbdf5f5059b52735d01.tar.gz
rust-285b9d1cd4e170f6a6c98cbdf5f5059b52735d01.zip
Delay a bug when we see SelfCtor in ref pattern
Diffstat (limited to 'src/test/ui/pattern')
-rw-r--r--src/test/ui/pattern/issue-95878.rs12
-rw-r--r--src/test/ui/pattern/issue-95878.stderr8
2 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/pattern/issue-95878.rs b/src/test/ui/pattern/issue-95878.rs
new file mode 100644
index 00000000000..f59814468b2
--- /dev/null
+++ b/src/test/ui/pattern/issue-95878.rs
@@ -0,0 +1,12 @@
+struct Foo<'a>(&'a ());
+
+impl<'a> Foo<'a> {
+    fn spam(&mut self, baz: &mut Vec<u32>) {
+        match 15 {
+            ref Self => (),
+            //~^ ERROR expected identifier, found keyword `Self`
+        }
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/pattern/issue-95878.stderr b/src/test/ui/pattern/issue-95878.stderr
new file mode 100644
index 00000000000..e0eea06e0a3
--- /dev/null
+++ b/src/test/ui/pattern/issue-95878.stderr
@@ -0,0 +1,8 @@
+error: expected identifier, found keyword `Self`
+  --> $DIR/issue-95878.rs:6:17
+   |
+LL |             ref Self => (),
+   |                 ^^^^ expected identifier, found keyword
+
+error: aborting due to previous error
+