rustc should magically detect repeating refactoring errors and compress them #125260
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This error report is now live as a repo:
https://github.com/workingjubilee/uwu-er-i-mean-owo
Code
If you have code that looks like this:
Where each
mod
has some contents like this:Then change the code this way:
The problem here is that I forgot to rename the items in the macro appropriately, and this is frequently missed by the way rust-analyzer's bulk-refactoring is integrated in at least some editors. We now get this error:
Current output
Desired output
Rationale and extra context
The preferred output is to swallow these into a single error, since the rest is just terminal spam, basically. Even pointing at different files where this error occurs is not very helpful, as the actual issue is I need to rename something in the macro.
It seems rustc is just smart enough to swallow this if this is a repeating macro error in the same file (possibly the same macro invocation, haven't experimented beyond this), but that's not always the case, and "how (not) well-factored my code is" would ideally matter less to diagnostics.
As a bonus round: rustc could notice these two errors, recognize they're similar signatures except for names, and just ask me directly if I forgot to rename something, like:
Other cases
No response
Rust Version
Anything else?
@rustbot label: +A-macros
The text was updated successfully, but these errors were encountered: