about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/macros/reparse-expr-issue-139495.rs7
-rw-r--r--tests/ui/macros/reparse-expr-issue-139495.stderr13
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/macros/reparse-expr-issue-139495.rs b/tests/ui/macros/reparse-expr-issue-139495.rs
new file mode 100644
index 00000000000..38d24573a53
--- /dev/null
+++ b/tests/ui/macros/reparse-expr-issue-139495.rs
@@ -0,0 +1,7 @@
+macro_rules! m {
+  ($abi : expr) => { extern $abi } //~ ERROR expected expression, found keyword `extern`
+}
+
+fn main() {
+    m!(-2)
+}
diff --git a/tests/ui/macros/reparse-expr-issue-139495.stderr b/tests/ui/macros/reparse-expr-issue-139495.stderr
new file mode 100644
index 00000000000..73a8ed87ba0
--- /dev/null
+++ b/tests/ui/macros/reparse-expr-issue-139495.stderr
@@ -0,0 +1,13 @@
+error: expected expression, found keyword `extern`
+  --> $DIR/reparse-expr-issue-139495.rs:2:22
+   |
+LL |   ($abi : expr) => { extern $abi }
+   |                      ^^^^^^ expected expression
+...
+LL |     m!(-2)
+   |     ------ in this macro invocation
+   |
+   = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 1 previous error
+