Skip to content

Commit b2be57d

Browse files
committed
Update test
1 parent 99bf016 commit b2be57d

File tree

2 files changed

+313
-17
lines changed

2 files changed

+313
-17
lines changed

tests/ui/cfg/path-kw-as-pred.rs

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//@ edition: 2024
2+
13
macro_rules! foo {
24
() => {
35
#[cfg($crate)] //~ ERROR `cfg` predicate key must be an identifier
@@ -16,7 +18,38 @@ macro_rules! foo {
1618
#[cfg_attr(super, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
1719
#[cfg_attr(self, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
1820
#[cfg_attr(Self, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
19-
mod _y {}
21+
mod _path_kw {}
22+
23+
#[cfg(struct)] //~ ERROR expected identifier, found keyword
24+
//~^ WARNING unexpected `cfg` condition name
25+
mod _non_path_kw1 {}
26+
#[cfg(enum)] //~ ERROR expected identifier, found keyword
27+
//~^ WARNING unexpected `cfg` condition name
28+
mod _non_path_kw2 {}
29+
#[cfg(async)] //~ ERROR expected identifier, found keyword
30+
//~^ WARNING unexpected `cfg` condition name
31+
mod _non_path_kw3 {}
32+
#[cfg(impl)] //~ ERROR expected identifier, found keyword
33+
//~^ WARNING unexpected `cfg` condition name
34+
mod _non_path_kw4 {}
35+
#[cfg(trait)] //~ ERROR expected identifier, found keyword
36+
//~^ WARNING unexpected `cfg` condition name
37+
mod _non_path_kw5 {}
38+
#[cfg_attr(struct, path = "foo")] //~ ERROR expected identifier, found keyword
39+
//~^ WARNING unexpected `cfg` condition name
40+
mod _non_path_kw6 {}
41+
#[cfg_attr(enum, path = "foo")] //~ ERROR expected identifier, found keyword
42+
//~^ WARNING unexpected `cfg` condition name
43+
mod _non_path_kw7 {}
44+
#[cfg_attr(async, path = "foo")] //~ ERROR expected identifier, found keyword
45+
//~^ WARNING unexpected `cfg` condition name
46+
mod _non_path_kw8 {}
47+
#[cfg_attr(impl, path = "foo")] //~ ERROR expected identifier, found keyword
48+
//~^ WARNING unexpected `cfg` condition name
49+
mod _non_path_kw9 {}
50+
#[cfg_attr(trait, path = "foo")] //~ ERROR expected identifier, found keyword
51+
//~^ WARNING unexpected `cfg` condition name
52+
mod _non_path_kw10 {}
2053

2154
fn main() {
2255
foo!();
@@ -25,4 +58,15 @@ fn main() {
2558
cfg!(super); //~ ERROR `cfg` predicate key must be an identifier
2659
cfg!(self); //~ ERROR `cfg` predicate key must be an identifier
2760
cfg!(Self); //~ ERROR `cfg` predicate key must be an identifier
61+
62+
cfg!(struct); //~ ERROR expected identifier, found keyword
63+
//~^ WARNING unexpected `cfg` condition name
64+
cfg!(enum); //~ ERROR expected identifier, found keyword
65+
//~^ WARNING unexpected `cfg` condition name
66+
cfg!(async); //~ ERROR expected identifier, found keyword
67+
//~^ WARNING unexpected `cfg` condition name
68+
cfg!(impl); //~ ERROR expected identifier, found keyword
69+
//~^ WARNING unexpected `cfg` condition name
70+
cfg!(trait); //~ ERROR expected identifier, found keyword
71+
//~^ WARNING unexpected `cfg` condition name
2872
}

0 commit comments

Comments
 (0)