summaryrefslogtreecommitdiffstats
path: root/src/test/ui/macros/syntax-error-recovery.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/macros/syntax-error-recovery.rs')
-rw-r--r--src/test/ui/macros/syntax-error-recovery.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ui/macros/syntax-error-recovery.rs b/src/test/ui/macros/syntax-error-recovery.rs
new file mode 100644
index 000000000..ae6de3c50
--- /dev/null
+++ b/src/test/ui/macros/syntax-error-recovery.rs
@@ -0,0 +1,18 @@
+macro_rules! values {
+ ($($token:ident($value:literal) $(as $inner:ty)? => $attr:meta,)*) => {
+ #[derive(Debug)]
+ pub enum TokenKind {
+ $(
+ #[$attr]
+ $token $($inner)? = $value,
+ )*
+ }
+ };
+}
+//~^^^^^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `(String)`
+//~| ERROR macro expansion ignores token `(String)` and any following
+
+values!(STRING(1) as (String) => cfg(test),);
+//~^ ERROR expected one of `!` or `::`, found `<eof>`
+
+fn main() {}