2023-08-02 18:59:30 -05:00
|
|
|
// compile-flags: --crate-type=lib
|
2023-07-23 23:55:47 -05:00
|
|
|
|
2023-08-21 08:05:01 -05:00
|
|
|
// https://github.com/rust-lang/rust/issues/113766
|
|
|
|
|
2023-07-23 23:55:47 -05:00
|
|
|
macro_rules! field {
|
|
|
|
($name:ident:$type:ty) => {
|
|
|
|
$name:$type
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
macro_rules! variant {
|
|
|
|
($name:ident) => {
|
|
|
|
$name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-24 12:05:10 -05:00
|
|
|
struct Struct {
|
2023-08-21 08:05:01 -05:00
|
|
|
//~^ NOTE while parsing this struct
|
2023-08-02 18:59:30 -05:00
|
|
|
field!(bar:u128),
|
|
|
|
//~^ NOTE macros cannot expand to struct fields
|
|
|
|
//~| ERROR unexpected token: `!`
|
|
|
|
//~| NOTE unexpected token after this
|
2023-07-24 12:05:10 -05:00
|
|
|
a: u32,
|
|
|
|
b: u32,
|
2023-08-21 08:05:01 -05:00
|
|
|
field!(recovers:()),
|
2023-07-23 23:55:47 -05:00
|
|
|
}
|
|
|
|
|
2023-07-24 12:05:10 -05:00
|
|
|
enum EnumVariant {
|
2023-08-02 18:59:30 -05:00
|
|
|
variant!(whoops),
|
|
|
|
//~^ NOTE macros cannot expand to enum variants
|
|
|
|
//~| ERROR unexpected token: `!`
|
|
|
|
//~| NOTE unexpected token after this
|
2023-07-24 12:05:10 -05:00
|
|
|
U32,
|
|
|
|
F64,
|
2023-08-02 18:59:30 -05:00
|
|
|
variant!(recovers),
|
|
|
|
//~^ NOTE macros cannot expand to enum variants
|
|
|
|
//~| ERROR unexpected token: `!`
|
|
|
|
//~| NOTE unexpected token after this
|
2023-08-21 08:05:01 -05:00
|
|
|
Data { //~ NOTE while parsing this struct
|
2023-08-02 18:59:30 -05:00
|
|
|
field!(x:u32),
|
|
|
|
//~^ NOTE macros cannot expand to struct fields
|
|
|
|
//~| ERROR unexpected token: `!`
|
|
|
|
//~| NOTE unexpected token after this
|
|
|
|
}
|
2023-07-24 12:05:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
enum EnumVariantField {
|
2023-08-21 08:05:01 -05:00
|
|
|
Named { //~ NOTE while parsing this struct
|
2023-08-02 18:59:30 -05:00
|
|
|
field!(oopsies:()),
|
|
|
|
//~^ NOTE macros cannot expand to struct fields
|
|
|
|
//~| ERROR unexpected token: `!`
|
|
|
|
//~| unexpected token after this
|
|
|
|
field!(oopsies2:()),
|
2023-07-24 12:05:10 -05:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
union Union {
|
2023-08-21 08:05:01 -05:00
|
|
|
//~^ NOTE while parsing this union
|
2023-07-24 12:05:10 -05:00
|
|
|
A: u32,
|
2023-08-02 18:59:30 -05:00
|
|
|
field!(oopsies:()),
|
|
|
|
//~^ NOTE macros cannot expand to union fields
|
|
|
|
//~| ERROR unexpected token: `!`
|
2023-08-21 08:05:01 -05:00
|
|
|
//~| NOTE unexpected token after this
|
2023-07-24 12:05:10 -05:00
|
|
|
B: u32,
|
2023-08-02 18:59:30 -05:00
|
|
|
field!(recovers:()),
|
2023-08-21 08:05:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// https://github.com/rust-lang/rust/issues/114636
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub struct Lazy {
|
|
|
|
//~^ NOTE while parsing this struct
|
|
|
|
unreachable!()
|
|
|
|
//~^ NOTE macros cannot expand to struct fields
|
2023-08-02 18:59:30 -05:00
|
|
|
//~| ERROR unexpected token: `!`
|
2023-08-21 08:05:01 -05:00
|
|
|
//~| NOTE unexpected token after this
|
2023-07-23 23:55:47 -05:00
|
|
|
}
|
2023-08-21 08:05:01 -05:00
|
|
|
|
|
|
|
fn main() {}
|