]> git.lizzy.rs Git - rust.git/blob - src/test/ui/cfg-attr-syntax-validation.rs
Auto merge of #54720 - davidtwco:issue-51191, r=nikomatsakis
[rust.git] / src / test / ui / cfg-attr-syntax-validation.rs
1 #[cfg] //~ ERROR `cfg` is not followed by parentheses
2 struct S1;
3
4 #[cfg = 10] //~ ERROR `cfg` is not followed by parentheses
5 struct S2;
6
7 #[cfg()] //~ ERROR `cfg` predicate is not specified
8 struct S3;
9
10 #[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified
11 struct S4;
12
13 #[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal
14 struct S5;
15
16 #[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier
17 struct S6;
18
19 #[cfg(a())] //~ ERROR invalid predicate `a`
20 struct S7;
21
22 #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string
23 struct S8;
24
25 macro_rules! generate_s9 {
26     ($expr: expr) => {
27         #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item
28         struct S9;
29     }
30 }
31
32 generate_s9!(concat!("nonexistent"));