|
1 | 1 | //@ edition: 2024 |
2 | 2 |
|
| 3 | +#![allow(unexpected_cfgs)] |
| 4 | + |
3 | 5 | macro_rules! foo { |
4 | 6 | () => { |
5 | | - #[cfg($crate)] //~ ERROR `cfg` predicate key must be an identifier |
6 | | - #[cfg_attr($crate, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier |
7 | | - mod _x {} |
| 7 | + #[cfg($crate)] //~ ERROR expected identifier, found reserved identifier `$crate` |
| 8 | + mod _cfg_dollar_crate {} |
| 9 | + #[cfg_attr($crate, path = "foo")] //~ ERROR expected identifier, found reserved identifier `$crate` |
| 10 | + mod _cfg_attr_dollar_crate {} |
8 | 11 |
|
9 | 12 | cfg!($crate); //~ ERROR `cfg` predicate key must be an identifier |
10 | 13 | }; |
11 | 14 | } |
12 | 15 |
|
13 | | -#[cfg(crate)] //~ ERROR `cfg` predicate key must be an identifier |
14 | | -#[cfg(super)] //~ ERROR `cfg` predicate key must be an identifier |
15 | | -#[cfg(self)] //~ ERROR `cfg` predicate key must be an identifier |
16 | | -#[cfg(Self)] //~ ERROR `cfg` predicate key must be an identifier |
17 | | -#[cfg_attr(crate, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier |
18 | | -#[cfg_attr(super, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier |
19 | | -#[cfg_attr(self, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier |
20 | | -#[cfg_attr(Self, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier |
21 | | -mod _path_kw {} |
| 16 | +#[cfg(crate)] //~ ERROR expected identifier, found keyword `crate` |
| 17 | +mod _cfg_crate {} |
| 18 | +#[cfg(super)] //~ ERROR expected identifier, found keyword `super` |
| 19 | +mod _cfg_super {} |
| 20 | +#[cfg(self)] //~ ERROR expected identifier, found keyword `self` |
| 21 | +mod _cfg_self_lower {} |
| 22 | +#[cfg(Self)] //~ ERROR expected identifier, found keyword `Self` |
| 23 | +mod _cfg_self_upper {} |
| 24 | +#[cfg_attr(crate, path = "foo")] //~ ERROR expected identifier, found keyword `crate` |
| 25 | +mod _cfg_attr_crate {} |
| 26 | +#[cfg_attr(super, path = "foo")] //~ ERROR expected identifier, found keyword `super` |
| 27 | +mod _cfg_attr_super {} |
| 28 | +#[cfg_attr(self, path = "foo")] //~ ERROR expected identifier, found keyword `self` |
| 29 | +mod _cfg_attr_self_lower {} |
| 30 | +#[cfg_attr(Self, path = "foo")] //~ ERROR expected identifier, found keyword `Self` |
| 31 | +mod _cfg_attr_self_upper {} |
22 | 32 |
|
23 | 33 | #[cfg(struct)] //~ ERROR expected identifier, found keyword |
24 | | -//~^ WARNING unexpected `cfg` condition name |
25 | | -mod _non_path_kw1 {} |
| 34 | +mod _cfg_struct {} |
26 | 35 | #[cfg(enum)] //~ ERROR expected identifier, found keyword |
27 | | -//~^ WARNING unexpected `cfg` condition name |
28 | | -mod _non_path_kw2 {} |
| 36 | +mod _cfg_enum {} |
29 | 37 | #[cfg(async)] //~ ERROR expected identifier, found keyword |
30 | | -//~^ WARNING unexpected `cfg` condition name |
31 | | -mod _non_path_kw3 {} |
| 38 | +mod _cfg_async {} |
32 | 39 | #[cfg(impl)] //~ ERROR expected identifier, found keyword |
33 | | -//~^ WARNING unexpected `cfg` condition name |
34 | | -mod _non_path_kw4 {} |
| 40 | +mod _cfg_impl {} |
35 | 41 | #[cfg(trait)] //~ ERROR expected identifier, found keyword |
36 | | -//~^ WARNING unexpected `cfg` condition name |
37 | | -mod _non_path_kw5 {} |
| 42 | +mod _cfg_trait {} |
38 | 43 | #[cfg_attr(struct, path = "foo")] //~ ERROR expected identifier, found keyword |
39 | | -//~^ WARNING unexpected `cfg` condition name |
40 | | -mod _non_path_kw6 {} |
| 44 | +mod _cfg_attr_struct {} |
41 | 45 | #[cfg_attr(enum, path = "foo")] //~ ERROR expected identifier, found keyword |
42 | | -//~^ WARNING unexpected `cfg` condition name |
43 | | -mod _non_path_kw7 {} |
| 46 | +mod _cfg_attr_enum {} |
44 | 47 | #[cfg_attr(async, path = "foo")] //~ ERROR expected identifier, found keyword |
45 | | -//~^ WARNING unexpected `cfg` condition name |
46 | | -mod _non_path_kw8 {} |
| 48 | +mod _cfg_attr_async {} |
47 | 49 | #[cfg_attr(impl, path = "foo")] //~ ERROR expected identifier, found keyword |
48 | | -//~^ WARNING unexpected `cfg` condition name |
49 | | -mod _non_path_kw9 {} |
| 50 | +mod _cfg_attr_impl {} |
50 | 51 | #[cfg_attr(trait, path = "foo")] //~ ERROR expected identifier, found keyword |
51 | | -//~^ WARNING unexpected `cfg` condition name |
52 | | -mod _non_path_kw10 {} |
| 52 | +mod _cfg_attr_trait {} |
53 | 53 |
|
54 | 54 | fn main() { |
55 | 55 | foo!(); |
56 | 56 |
|
57 | | - cfg!(crate); //~ ERROR `cfg` predicate key must be an identifier |
58 | | - cfg!(super); //~ ERROR `cfg` predicate key must be an identifier |
59 | | - cfg!(self); //~ ERROR `cfg` predicate key must be an identifier |
60 | | - cfg!(Self); //~ ERROR `cfg` predicate key must be an identifier |
| 57 | + cfg!(crate); //~ ERROR expected identifier, found keyword `crate` |
| 58 | + cfg!(super); //~ ERROR expected identifier, found keyword `super` |
| 59 | + cfg!(self); //~ ERROR expected identifier, found keyword `self` |
| 60 | + cfg!(Self); //~ ERROR expected identifier, found keyword `Self` |
61 | 61 |
|
62 | 62 | cfg!(struct); //~ ERROR expected identifier, found keyword |
63 | | - //~^ WARNING unexpected `cfg` condition name |
64 | 63 | cfg!(enum); //~ ERROR expected identifier, found keyword |
65 | | - //~^ WARNING unexpected `cfg` condition name |
66 | 64 | cfg!(async); //~ ERROR expected identifier, found keyword |
67 | | - //~^ WARNING unexpected `cfg` condition name |
68 | 65 | cfg!(impl); //~ ERROR expected identifier, found keyword |
69 | | - //~^ WARNING unexpected `cfg` condition name |
70 | 66 | cfg!(trait); //~ ERROR expected identifier, found keyword |
71 | | - //~^ WARNING unexpected `cfg` condition name |
72 | 67 | } |
| 68 | + |
| 69 | +#[cfg(r#crate)] // Ok |
| 70 | +mod _cfg_r_crate {} |
| 71 | +#[cfg(r#super)] // Ok |
| 72 | +mod _cfg_r_super {} |
| 73 | +#[cfg(r#self)] // Ok |
| 74 | +mod _cfg_r_self_lower {} |
| 75 | +#[cfg(r#Self)] // Ok |
| 76 | +mod _cfg_r_self_upper {} |
0 commit comments