Account for proc macro helpers when parsing attr
This commit is contained in:
parent
44587d1bfc
commit
8ab7696acd
@ -1229,9 +1229,10 @@ fn collect_proc_macro_def(&mut self, func_name: &Name, attrs: &Attrs) {
|
||||
} else {
|
||||
let derive = attrs.by_key("proc_macro_derive");
|
||||
if let Some(arg) = derive.tt_values().next() {
|
||||
if let [TokenTree::Leaf(Leaf::Ident(trait_name))] = &*arg.token_trees {
|
||||
if let [TokenTree::Leaf(Leaf::Ident(trait_name)), ..] = &*arg.token_trees {
|
||||
trait_name.as_name()
|
||||
} else {
|
||||
log::trace!("malformed `#[proc_macro_derive]`: {}", arg);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -688,13 +688,20 @@ pub fn attribute_macro(_args: TokenStream, item: TokenStream) -> TokenStream {
|
||||
pub fn derive_macro(_item: TokenStream) -> TokenStream {
|
||||
TokenStream
|
||||
}
|
||||
|
||||
#[proc_macro_derive(AnotherTrait, attributes(helper_attr))]
|
||||
pub fn derive_macro_2(_item: TokenStream) -> TokenStream {
|
||||
TokenStream
|
||||
}
|
||||
",
|
||||
expect![[r#"
|
||||
crate
|
||||
AnotherTrait: m
|
||||
DummyTrait: m
|
||||
TokenStream: t v
|
||||
attribute_macro: v m
|
||||
derive_macro: v
|
||||
derive_macro_2: v
|
||||
function_like_macro: v m
|
||||
"#]],
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user