-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unused_qualifications
lints on macro-generated paths which happen to have spans from the input
#122519
Comments
Note: the
Bisection points to #121528 cc: @Alexendoo (@petrochenkov as reviewer) for a comment on this. Thanks! |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-medium |
The proc macro sets the span of the path + idents to the span of I don't know if there's an issue for it anywhere but it's the same root issue that necessitates the |
This is an issue in specific proc macro, not in rustc. In clippy they hide such issues with hacks like |
Absolute paths in general shouldn't be reported by |
I've had other lints run into this issue too, I think the proc macros need to use something like |
Yes, but it's not a bug in that.
Why not? I saw that issue, but I don't understand the claim. The absolute path is an unused qualification. Is it just “If you are writing an absolute path, you probably really meant that”, or is there some deeper reason?
Ah, I didn't read the macro code closely enough — I checked the creation of the path itself, but I didn't see the |
This misbehavior is about to become stable in 1.78. I believe it would be fixed (in the specific case, at least) by #122435 but that was not merged in time and has not been backported. |
I think we can close this as solved |
Code
Current output
Desired output
No warning.
Rationale and extra context
Rationale:
#[allow(unused_qualifications)]
to solve this problem, but that would be additional busywork for macro authors.Therefore, I propose that
unused_qualifications
should not lint on a path unless the tokens that it proposes deleting all have spans from the original source text (not any other spans that a macro might produce).There is currently a PR out for not linting on absolute paths, which would also fix this problem, but I don't understand the rationale for doing that outside of macros, so I'm filing this issue for consideration of the specific case of macros.
Other cases
This occurs only on nightly, not on stable 1.76.0 or beta.
For some reason, among all the proc macros in use in the project I'm testing on nightly, only
bytemuck
is affected.Rust Version
Anything else?
@rustbot label +regression-from-stable-to-nightly
The text was updated successfully, but these errors were encountered: