rust/tests/ui/attributes/helper-attr-interpolated-non-lit-arg.rs
León Orell Valerian Liehr 8f472e8b5c
Add regression test for a former ICE involving helper attributes containing interpolated tokens
Co-authored-by: Jana Dönszelmann <jana@donsz.nl>
2025-08-14 03:39:32 +02:00

21 lines
657 B
Rust

// Regression test for <https://github.com/rust-lang/rust/issues/140612>.
//@ proc-macro: derive_macro_with_helper.rs
//@ edition: 2018
//@ check-pass
macro_rules! expand {
($text:expr) => {
#[derive(derive_macro_with_helper::Derive)]
// This inert attr is completely valid because it follows the grammar
// `#` `[` SimplePath DelimitedTokenStream `]`.
// However, we used to incorrectly delay a bug here and ICE when trying to parse `$text` as
// the inside of a "meta item list" which may only begin with literals or paths.
#[arg($text)]
pub struct Foo;
};
}
expand!(1 + 1);
fn main() {}