1 // Parse `cfg_attr` with varying numbers of attributes and trailing commas
3 // Completely empty `cfg_attr` input
4 #[cfg_attr()] //~ error: malformed `cfg_attr` attribute input
5 struct NoConfigurationPredicate;
7 // Zero attributes, zero trailing comma (comma manatory here)
8 #[cfg_attr(all())] //~ error: expected `,`, found end of `cfg_attr`
11 // Zero attributes, one trailing comma
12 #[cfg_attr(all(),)] // Ok
15 // Zero attributes, two trailing commas
16 #[cfg_attr(all(),,)] //~ ERROR expected identifier
19 // One attribute, no trailing comma
20 #[cfg_attr(all(), must_use)] // Ok
23 // One attribute, one trailing comma
24 #[cfg_attr(all(), must_use,)] // Ok
27 // One attribute, two trailing commas
28 #[cfg_attr(all(), must_use,,)] //~ ERROR expected identifier
31 // Two attributes, no trailing comma
32 #[cfg_attr(all(), must_use, deprecated)] // Ok
35 // Two attributes, one trailing comma
36 #[cfg_attr(all(), must_use, deprecated,)] // Ok
39 // Two attributes, two trailing commas
40 #[cfg_attr(all(), must_use, deprecated,,)] //~ ERROR expected identifier
43 // Wrong delimiter `[`
45 //~^ ERROR wrong `cfg_attr` delimiters
46 //~| ERROR expected identifier, found `,`
49 // Wrong delimiter `{`
51 //~^ ERROR wrong `cfg_attr` delimiters
52 //~| ERROR expected identifier, found `,`