-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Command-line -F
then -A
lint-level flags behave inconsistently versus in-source #[forbid(..)]
then #[allow(..)]
lint-level attributes
#133346
Comments
-F
then -A
lint-level flags behave inconsistently versus in-source #[forbid(..)]
then #[allow(..)]
lint-level attributes
(Tagging as |
To be clear, the way the attributes behave here is IMO the intended way. "forbid" means "cannot be allowed later", so |
This allegedly intended behaviour of the conflicting attributes themselves being an unconditional hard error (rather than only if the lint would trigger) has some unfortunate consequences. The case I'm running into is:
In this case, we get a hard error (E0453) - even though the offending lint would not actually be triggered. I think that these exceptions from the macro are probably over-broad, but I can't really fault the macro crate for not wanting to deal with complaints about new clippy lints. My preferred solution would be for the hard error E0453 to instead be a deny by default lint. We would then allow that for this case, which would be us taking on responsibility for the future breakage introduced by changes the macro to use I would like this to be consistent between command line and attributes, but I'd rather the behaviour were consistently the way it works on the command line. |
@DJMcNab that is a separate issue, please file a new issue for this. This issue here is about the command-line flags. |
That contradicts your earlier statements. This issue got opened because if you pass |
Hmm, I based that sentence on the original comment in this issue:
That error to me certainly looks like the My reading of this issue is that it was tracking that the |
The -A unused is not ignored any more, that got fixed years ago. It leads to a hard error. (The issue description is a bit confusing, but anyway it's a closed issue now so not worth fully fleshing out )
This issue was tracking that the `allow(unused)` in the 2nd example is accepted, at leads to `unused` being allowed.
|
For a given program
Currently (rustc 1.82.0),
rustc -F unused -A unused
will produceHowever, switching to source lint level attributes
will instead produce
This was changed in #67885.
Original issue reported by @RalfJung, this issue is extracted out of #70819 to focus on the difference between rustc cli lint level flags (e.g.
-F..
/-A..
) versus source lint level attributes (e.g.#[forbid(..)]
/#[allow(..)]
).cc @RalfJung could you double-check if my transcription is accurate of what you find surprising/undesirable?
The text was updated successfully, but these errors were encountered: