about summary refs log tree commit diff
path: root/tests/ui/attributes/nonterminal-expansion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/attributes/nonterminal-expansion.rs')
-rw-r--r--tests/ui/attributes/nonterminal-expansion.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/attributes/nonterminal-expansion.rs b/tests/ui/attributes/nonterminal-expansion.rs
new file mode 100644
index 00000000000..97bf225f0cc
--- /dev/null
+++ b/tests/ui/attributes/nonterminal-expansion.rs
@@ -0,0 +1,18 @@
+// Macros were previously expanded in `Expr` nonterminal tokens, now they are not.
+
+macro_rules! pass_nonterminal {
+    ($n:expr) => {
+        #[repr(align($n))]
+        //~^ ERROR expected unsuffixed literal or identifier, found `n!()`
+        //~| ERROR incorrect `repr(align)` attribute format
+        struct S;
+    };
+}
+
+macro_rules! n {
+    () => { 32 };
+}
+
+pass_nonterminal!(n!());
+
+fn main() {}