rust/tests/ui/attributes/nonterminal-expansion.rs
Nicholas Nethercote 7ea59e053b Remove NtMeta.
Note: there was an existing code path involving `Interpolated` in
`MetaItem::from_tokens` that was dead. This commit transfers that to the
new form, but puts an `unreachable!` call inside it.
2025-02-28 08:42:06 +11:00

21 lines
505 B
Rust

//@ compile-flags: -Zdeduplicate-diagnostics=yes
// Macros were previously expanded in `Expr` nonterminal tokens, now they are not.
macro_rules! pass_nonterminal {
($n:expr) => {
#[repr(align($n))]
//~^ ERROR expected unsuffixed literal, found expression `n!()`
//~^^ ERROR incorrect `repr(align)` attribute format: `align` expects a literal integer as argument [E0693]
struct S;
};
}
macro_rules! n {
() => { 32 };
}
pass_nonterminal!(n!());
fn main() {}