]> git.lizzy.rs Git - rust.git/blob - src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs
Support ? Kleene operator in 2015.
[rust.git] / src / test / ui / macros / macro-at-most-once-rep-2015-ques-sep.rs
1 // Test behavior of `?` macro _separator_ under the 2015 edition. Namely, `?` can be used as a
2 // separator, but you get a migration warning for the edition.
3
4 // edition:2015
5 // compile-pass
6
7 #![warn(rust_2018_compatibility)]
8
9 macro_rules! bar {
10     ($(a)?*) => {} //~WARN using `?` as a separator
11     //~^WARN this was previously accepted
12 }
13
14 macro_rules! baz {
15     ($(a)?+) => {} //~WARN using `?` as a separator
16     //~^WARN this was previously accepted
17 }
18
19 fn main() {
20     bar!();
21     bar!(a);
22     bar!(a?a);
23     bar!(a?a?a?a?a);
24
25     baz!(a);
26     baz!(a?a);
27     baz!(a?a?a?a?a);
28 }