rust/tests/ui/attributes/nonterminal-expansion.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
505 B
Rust
Raw Normal View History

//@ 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!()`
2025-02-09 21:50:01 +00:00
//~^^ 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() {}