Errors about unknown attributes when attr macro failed to resolve
Open
Nobody has claimed this yet.
A-attributes
A-diagnostics
A-resolve
D-verbose
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
#[derive(ILove)]
struct A {
#[beans]
pub yes: bool,
}
Current output
error: cannot find derive macro `ILove` in this scope
--> src/lib.rs:1:10
|
1 | #[derive(ILove)]
| ^^^^^
error: cannot find attribute `beans` in this scope
--> src/lib.rs:3:7
|
3 | #[beans]
| ^^^^^
Desired output
error: cannot find derive macro `ILove` in this scope
--> src/lib.rs:1:10
|
1 | #[derive(ILove)]
| ^^^^^
Rationale and extra context
The beans attribute may be provided by the proc macro, this error is a useless and noisy follow-up error which should be suppressed.
Other cases
#[you_love]
struct A {
#[beans]
pub yes: bool,
}
Rust Version
nightly-2024-02-24
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the diagnostic using the Rust Playground example and nightly-2024-02-24, including both the failing derive macro and the unknown attribute cases. Trace the compiler's handling of attributes after an unresolved derive or attribute macro; done means the follow-up cannot find attribute error is suppressed while the unresolved derive error remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100