diff options
Diffstat (limited to 'tests/ui/parser/macro/macro-expand-to-match-arm.rs')
-rw-r--r-- | tests/ui/parser/macro/macro-expand-to-match-arm.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/parser/macro/macro-expand-to-match-arm.rs b/tests/ui/parser/macro/macro-expand-to-match-arm.rs new file mode 100644 index 000000000..39d1d065e --- /dev/null +++ b/tests/ui/parser/macro/macro-expand-to-match-arm.rs @@ -0,0 +1,18 @@ +macro_rules! arm { + ($pattern:pat => $block:block) => { + $pattern => $block + }; +} + +fn main() { + let x = Some(1); + match x { + Some(1) => {}, + arm!(None => {}), + //~^ NOTE macros cannot expand to match arms + //~| ERROR unexpected `,` in pattern + // doesn't recover + Some(2) => {}, + _ => {}, + }; +} |