-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Tracking issue for RFC 2383, "Lint Reasons RFC" #54503
Comments
I started looking at this tonight. (Briefly; I regret that my time is limited.) The example output in the RFC puts a The reason should probably be stored as a third field inside of |
This is just for the `reason =` name-value meta-item; the `#[expect(lint)]` attribute also described in the RFC is a problem for another day. The place where we were directly calling `emit()` on a match block (whose arms returned a mutable reference to a diagnostic-builder) was admittedly cute, but no longer plausibly natural after adding the if-let to the end of the `LintSource::Node` arm. This regards rust-lang#54503.
This is just for the `reason =` name-value meta-item; the `#[expect(lint)]` attribute also described in the RFC is a problem for another day. The place where we were directly calling `emit()` on a match block (whose arms returned a mutable reference to a diagnostic-builder) was admittedly cute, but no longer plausibly natural after adding the if-let to the end of the `LintSource::Node` arm. This regards rust-lang#54503.
It's a little bit sad/awkward that reason comments are most useful in practice for (This observation prompted by my thought that we should be able to dogfood |
We could add a lint that suggests turning |
I apologize for my absence on this issue.
My standing question was "how should the |
Here's the initial work of The remaining thing is to trigger the |
Hello everyone, Is there someone here who could mentor me? My contributions so far have only focussed on Clippy. If not I would most likely ask on Zulip for help 🙃. |
@xFrednet I would happily mentor you on this! Let me start by opening an issue dedicated to jus the implementaton, since I dislike using the tracking issue for that sort of thing. I'll assign it to you. |
Issue #55112 is related to the implementation of the
Noted as a FIXME in the Just to keep track that this also has to be fixed before stabilization. PR: #94580 |
The topic has been discussed as part of the design meeting. Generally, it was said, that
This might work, if the try-and-catch model is used for the expect attribute. Though, for me, this name doesn't imply, that a warning should be issued if nothing gets suppressed. That's why I like If you have any thoughts on the mental model, a comment on Zulip would be appreciated. The discussion has sadly stalled, and some more feedback might help :) |
as far as i understand, unused allow annotations are only reported when i'd prefer another lint that reports unused allows (and warns/denies/forbids as well) the way eslint does this is you specify it in its config file, which is not what i prefer but its something to look at |
Some The idea for expect is, that it would be used instead of
Implementing this as a lint, might be possible, but would require the same framework and tracking nightly rustc currently does for |
i think allowing conditionally based on the cfg is better but we cant impose that i think, my idea was this feature would be opt-in but in a way that doesnt require users to adding another attribute to every |
They shouldn't add another attribute, they should replace the |
Clippy already has the |
ah, thats what the discussion is about then, i agree |
After the lang meeting in March, there was a discussion on Zulip what the mental model of the
I've created a list of use cases to hopefully help with the discussion of these two models. Usually, both models work equally well, except for use case 4 which would only be possible with the first model. I'm nominating this for T-lang to review. |
@xFrednet I just want to say, these are some excellent write-ups / summarization. |
…u,blyxyas Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](rust-lang/rust#99063) was stalled by some unresolved questions. These have been discussed in a [lang team](rust-lang/lang-team#191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in rust-lang/rust#115980 I've just updated the [stabilization report](rust-lang/rust#54503 (comment)) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: rust-lang/rust#54503 Stabilization Report: rust-lang/rust#54503 (comment) Documentation Update: rust-lang/reference#1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
…u,blyxyas Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](rust-lang/rust#99063) was stalled by some unresolved questions. These have been discussed in a [lang team](rust-lang/lang-team#191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in rust-lang/rust#115980 I've just updated the [stabilization report](rust-lang/rust#54503 (comment)) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: rust-lang/rust#54503 Stabilization Report: rust-lang/rust#54503 (comment) Documentation Update: rust-lang/reference#1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
…u,blyxyas Let's `#[expect]` some lints: Stabilize `lint_reasons` (RFC 2383) Let's give this another try! The [previous stabilization attempt](rust-lang/rust#99063) was stalled by some unresolved questions. These have been discussed in a [lang team](rust-lang/lang-team#191) meeting. The last open question, regarding the semantics of the `#[expect]` attribute was decided on in rust-lang/rust#115980 I've just updated the [stabilization report](rust-lang/rust#54503 (comment)) with the discussed questions and decisions. Luckily, the decision is inline with the current implementation. This hopefully covers everything. Let's hope that the CI will be green like the spring. fixes #115980 fixes #54503 --- r? `@wesleywiser` Tacking Issue: rust-lang/rust#54503 Stabilization Report: rust-lang/rust#54503 (comment) Documentation Update: rust-lang/reference#1237 <!-- For Clippy: changelog: [`allow_attributes`]: Is now available on stable, since the `lint_reasons` feature was stabilized changelog: [`allow_attributes_without_reason`]: Is now available on stable, since the `lint_reasons` feature was stabilized --> --- Roses are red, Violets are blue, Let's expect lints, With reason clues
This is a tracking issue for the RFC "Lint Reasons RFC" (rust-lang/rfcs#2383).
Steps:
reason =
lint reasons (RFC 2383, part 1) #54683#[expect(lint)]
-- see Implement expect attribute from RFC 2383, "Lint Reasons RFC" #85549Unresolved questions:
The text was updated successfully, but these errors were encountered: