From bceaba86b92325f807351426bfd93ba0513225a4 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 30 Oct 2019 17:34:00 +0100 Subject: rollback gating for failing macro matchers --- .../parser/issue-65846-rollback-gating-failing-matcher.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs (limited to 'src/test/ui/parser') diff --git a/src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs b/src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs new file mode 100644 index 00000000000..9d68a7bffde --- /dev/null +++ b/src/test/ui/parser/issue-65846-rollback-gating-failing-matcher.rs @@ -0,0 +1,14 @@ +// run-pass + +// Test that failing macro matchers will not cause pre-expansion errors +// even though they use a feature that is pre-expansion gated. + +macro_rules! m { + ($e:expr) => { 0 }; // This fails on the input below due to `, foo`. + ($e:expr,) => { 1 }; // This also fails to match due to `foo`. + (box $e:expr, foo) => { 2 }; // Successful matcher, we should get `2`. +} + +fn main() { + assert_eq!(2, m!(box 42, foo)); +} -- cgit 1.4.1-3-g733a5