Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/ui/attributes/auxiliary/derive_macro_with_helper.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(Derive, attributes(arg))]
pub fn derive(_: TokenStream) -> TokenStream {
TokenStream::new()
}
20 changes: 20 additions & 0 deletions tests/ui/attributes/helper-attr-interpolated-non-lit-arg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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() {}
Loading