about summary refs log tree commit diff
path: root/tests/ui/pattern
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-01 09:18:49 +0000
committerbors <bors@rust-lang.org>2024-09-01 09:18:49 +0000
commit3c0996b2fa1c0adc8cdffe2cc7a9d97eeaf11dc5 (patch)
tree768c0244df33445c56a1fd63b8639818c3b4a3c0 /tests/ui/pattern
parentf03c7b21700478c6c2b335b37caba72c3a06e447 (diff)
parent53451c2b76169532d5398614c5778c7bc4f68985 (diff)
downloadrust-3c0996b2fa1c0adc8cdffe2cc7a9d97eeaf11dc5.tar.gz
rust-3c0996b2fa1c0adc8cdffe2cc7a9d97eeaf11dc5.zip
Auto merge of #3854 - rust-lang:rustup-2024-09-01, r=RalfJung
Automatic Rustup
Diffstat (limited to 'tests/ui/pattern')
-rw-r--r--tests/ui/pattern/patterns-dont-match-nt-statement.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/pattern/patterns-dont-match-nt-statement.rs b/tests/ui/pattern/patterns-dont-match-nt-statement.rs
new file mode 100644
index 00000000000..c8d41459383
--- /dev/null
+++ b/tests/ui/pattern/patterns-dont-match-nt-statement.rs
@@ -0,0 +1,19 @@
+//@ check-pass
+
+// Make sure that a `stmt` nonterminal does not eagerly match against
+// a `pat`, since this will always cause a parse error...
+
+macro_rules! m {
+    ($pat:pat) => {};
+    ($stmt:stmt) => {};
+}
+
+macro_rules! m2 {
+    ($stmt:stmt) => {
+        m! { $stmt }
+    };
+}
+
+m2! { let x = 1 }
+
+fn main() {}