-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Proc-macro helper attributes on lifetime and const parameters fail to resolve if a built-in derive macro is present #132561
Copy link
Copy link
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I was making a derive proc macro and stumbled upon this weird error, and was told on the rust discord that this might be a bug. Basically, I have a proc macro that uses a helper attribute like this:
The
#[test_helper]attribute is used on generics - including lifetime generics.When I use it normally it works fine, but if I try to derive it together with another trait, such as
Clone- it fails to compile, saying that#[test_helper]was not found in the scope.There is no error if I put the attribute on a type generic or on a field.
cargo expand-ed code:I have also made a minimal reproducible example.
Meta
rustc --version --verbose:If this is really a bug, I can try to investigate if anyone can help me and point me in the right direction.