2025-07-07 09:10:38 +02:00
|
|
|
#[cfg]
|
|
|
|
|
//~^ ERROR malformed `cfg` attribute
|
|
|
|
|
//~| NOTE expected this to be a list
|
2025-08-11 17:02:32 +00:00
|
|
|
//~| NOTE for more information, visit
|
2018-09-02 00:13:22 +03:00
|
|
|
struct S1;
|
|
|
|
|
|
2025-07-07 09:10:38 +02:00
|
|
|
#[cfg = 10]
|
|
|
|
|
//~^ ERROR malformed `cfg` attribute
|
|
|
|
|
//~| NOTE expected this to be a list
|
2025-08-11 17:02:32 +00:00
|
|
|
//~| NOTE for more information, visit
|
2018-09-02 00:13:22 +03:00
|
|
|
struct S2;
|
|
|
|
|
|
2025-07-07 09:10:38 +02:00
|
|
|
#[cfg()]
|
|
|
|
|
//~^ ERROR malformed `cfg` attribute
|
|
|
|
|
//~| NOTE expected a single argument here
|
2025-08-11 17:02:32 +00:00
|
|
|
//~| NOTE for more information, visit
|
2018-09-02 00:13:22 +03:00
|
|
|
struct S3;
|
|
|
|
|
|
2025-07-07 09:10:38 +02:00
|
|
|
#[cfg(a, b)]
|
|
|
|
|
//~^ ERROR malformed `cfg` attribute
|
|
|
|
|
//~| NOTE expected a single argument here
|
2025-08-11 17:02:32 +00:00
|
|
|
//~| NOTE for more information, visit
|
2018-09-02 00:13:22 +03:00
|
|
|
struct S4;
|
|
|
|
|
|
2025-07-07 09:10:38 +02:00
|
|
|
#[cfg("str")] //~ ERROR `cfg` predicate key must be an identifier
|
2018-09-02 00:13:22 +03:00
|
|
|
struct S5;
|
|
|
|
|
|
|
|
|
|
#[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier
|
|
|
|
|
struct S6;
|
|
|
|
|
|
|
|
|
|
#[cfg(a())] //~ ERROR invalid predicate `a`
|
|
|
|
|
struct S7;
|
|
|
|
|
|
2025-07-07 09:10:38 +02:00
|
|
|
#[cfg(a = 10)] //~ ERROR malformed `cfg` attribute input
|
|
|
|
|
//~^ NOTE expected a string literal here
|
2025-08-11 17:02:32 +00:00
|
|
|
//~| NOTE for more information, visit
|
2018-09-02 00:13:22 +03:00
|
|
|
struct S8;
|
|
|
|
|
|
2025-07-07 09:10:38 +02:00
|
|
|
#[cfg(a = b"hi")] //~ ERROR malformed `cfg` attribute input
|
|
|
|
|
//~^ NOTE expected a normal string literal, not a byte string literal
|
2018-10-09 22:55:07 +08:00
|
|
|
struct S9;
|
|
|
|
|
|
|
|
|
|
macro_rules! generate_s10 {
|
2018-09-02 00:13:22 +03:00
|
|
|
($expr: expr) => {
|
2019-01-02 02:21:05 +03:00
|
|
|
#[cfg(feature = $expr)]
|
2025-07-31 15:38:44 +02:00
|
|
|
//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
|
2018-10-09 22:55:07 +08:00
|
|
|
struct S10;
|
2018-09-02 00:13:22 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-09 22:55:07 +08:00
|
|
|
generate_s10!(concat!("nonexistent"));
|
2025-07-07 09:10:38 +02:00
|
|
|
//~^ NOTE in this expansion of generate_s10!
|
2018-12-16 20:23:27 +03:00
|
|
|
|
|
|
|
|
fn main() {}
|