2020-07-01 11:12:49 +00:00
|
|
|
struct S(u8, (u8, u8));
|
|
|
|
|
|
|
|
macro_rules! generate_field_accesses {
|
|
|
|
($a:tt, $b:literal, $c:expr) => {
|
|
|
|
let s = S(0, (0, 0));
|
|
|
|
|
|
|
|
s.$a; // OK
|
|
|
|
{ s.$b; } //~ ERROR unexpected token: `1.1`
|
2023-07-31 14:55:47 +00:00
|
|
|
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found literal `1.1`
|
2020-07-01 11:12:49 +00:00
|
|
|
{ s.$c; } //~ ERROR unexpected token: `1.1`
|
2023-07-31 14:55:47 +00:00
|
|
|
//~| ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found expression `1.1`
|
2020-07-01 11:12:49 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
generate_field_accesses!(1.1, 1.1, 1.1);
|
|
|
|
}
|