Similarly named macros aren't suggested for incorrect macro names in anyhow
Open
Nobody has claimed this yet.
A-diagnostics
A-macros
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Code
use anyhow;
fn main() {
// should be format_err!()
anyhow::format_error!("foo");
}
Current output
error[E0433]: failed to resolve: could not find `format_error` in `anyhow`
--> src/main.rs:5:13
|
5 | anyhow::format_error!("foo");
| ^^^^^^^^^^^^ could not find `format_error` in `anyhow`
Desired output
error[E0433]: failed to resolve: could not find `format_error` in `anyhow`
--> src/main.rs:5:13
|
5 | anyhow::format_error!("foo");
| ^^^^^^^^^^^^ help: a macro with a similar name exists: `format_err`
Rationale and extra context
This works for ppanic!(), so maybe the threshold similarity threshold isn't being met in the anyhow case?
Other cases
No response
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 Rust compiler diagnostic with the anyhow::format_error! example and compare it with the ppanic! case mentioned in the issue. Start by tracing the compiler's unresolved macro-name suggestion logic and its similarity threshold; done means the error suggests format_err! for the shown code without regressing existing suggestions.
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
- 35/100