Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLint Reasons RFC #2383
Conversation
Centril
added
the
T-lang
label
Apr 2, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Without prior knowledge of this RFC, if I saw Come to think of it, why does the existing |
This comment has been minimized.
This comment has been minimized.
Probably in part because sometimes macros need to suppress things that only happen sometimes -- unreachable code in the error handling if the function returns |
This comment has been minimized.
This comment has been minimized.
DavidMikeSimon
commented
Apr 4, 2018
|
Perhaps |
This comment has been minimized.
This comment has been minimized.
|
Bikeshed: we have |
This comment has been minimized.
This comment has been minimized.
jan-hudec
commented
Apr 8, 2018
|
I'd like to suggest an alternative for the second part: Define an |
This comment has been minimized.
This comment has been minimized.
|
While I don't feel strongly about reason strings one way or another (and I definitely don't want the optional new comment form), I do very much like Also, you have a golden opportunity here: you should discuss the appropriate compiler behavior for |
This comment has been minimized.
This comment has been minimized.
That seems to me like an argument for the alternative with the |
joshtriplett
added
the
I-nominated
label
May 3, 2018
This comment has been minimized.
This comment has been minimized.
|
I would prefer to keep
|
This comment has been minimized.
This comment has been minimized.
|
We discussed this in the lang team meeting, and we were all quite excited about the @rfcbot fcp merge |
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
May 3, 2018
•
|
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
May 3, 2018
This comment has been minimized.
This comment has been minimized.
|
(Also, I wasn't entirely joking about the semantics of |
Centril
removed
the
I-nominated
label
May 4, 2018
This comment has been minimized.
This comment has been minimized.
|
A few questions here:
|
This comment has been minimized.
This comment has been minimized.
Somewhat: the compiler will tell you if you don't have any |
This comment has been minimized.
This comment has been minimized.
Not in the
Anything that is a member of the group matches; this is as true of warn and deny as it is of expect.
Let me see if I understand this correctly: mod foo {
#![expect(expectation_missing)]
#[expect(unused_mut)]
fn bar() {
let mut v = v[3, 2, 4, 1, 5];
v.sort();
}
}
Now eliminate
As far as I can understand this, these are consistent and non-paradoxical behaviors. The All:
I agree that
I have become more aware that we use attributes for altering control flow (
Agreed. I included it solely as a brainstorm, and to provided a prior-art reference for if a formalization of magic comments ever does arise. It is unrelated to the main thrust of this RFC and I will happily strip it from the text if/when this is approved to merge. |
This comment has been minimized.
This comment has been minimized.
|
@myrrlyn So, you're suggesting that an "expectation_missing" lint doesn't get looked at at the level it's produced, only at the next level out? So, in particular, if you'd put That's...consistent, but it seems wrong somehow. I think I'd prefer to have |
This comment has been minimized.
This comment has been minimized.
|
... I think I don't know how lints travel the scope tree. The way I have always thought about it, they start at the scope where they were raised and then the linter searches "down", that is, through the progressively enclosing scopes, for a modifier and halts the search at the first one it finds. I also might be misunderstanding where lint control attributes are placed. Suppose we have the following code: #[expect(expectation_missing)]
mod foo {
#[expect(expectation_missing)]
fn bar() {
#[expect(unused_mut)]
let mut v = 0;
}
}This is what I think is the chronological order of events when this code gets linted.
Assuming I know how lints work, which is very questionable, each scope generates lints internally, that are then processed whenever the linter passes a semicolon or a closing brace. Each This seems like it makes sense in my head but that's predicated on my current model of how the lint system works. Update: I ran an experiment rather than make shit up. Consecutive lints on an item are processed as a stack. #[deny(keyboard_smash)] // made up lint name
#[deny(unknown_lints)]
mod foo {}When When It runs the default If I switch those two lines around, so keyboard_smash runs and lints before unknown_lints, which detects the lint, the compilation halts. The #[expect(expectation_missing)]
#[expect(unused_mut)]
let v = 0;No unused_mut is raised, so the lower expect fires. An expectation_missing is raised, so the upper expect disarms. No lints leave. #[expect(unused_mut)]
#[expect(expectation_missing)]
let v = 0;No expectation_missing is raised, so the lower lint fires. No unused_mut is raised, so the upper expect fires. Two lints leave. |
This comment has been minimized.
This comment has been minimized.
|
If lints aren't a stack machine then I don't really have any ideas :/ I feel like |
Centril
assigned
joshtriplett
Sep 6, 2018
This comment has been minimized.
This comment has been minimized.
|
@rfcbot reviewed -- d'oh, thought I did this already |
rfcbot
added
proposed-final-comment-period
disposition-merge
labels
Sep 6, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Sep 6, 2018
|
|
rfcbot
added
final-comment-period
and removed
proposed-final-comment-period
labels
Sep 6, 2018
rfcbot
added
the
finished-final-comment-period
label
Sep 16, 2018
This comment has been minimized.
This comment has been minimized.
rfcbot
commented
Sep 16, 2018
|
The final comment period, with a disposition to merge, as per the review above, is now complete. |
rfcbot
removed
the
final-comment-period
label
Sep 16, 2018
Centril
referenced this pull request
Sep 23, 2018
Open
Tracking issue for RFC 2383, "Lint Reasons RFC" #54503
Centril
merged commit 863b37c
into
rust-lang:master
Sep 23, 2018
This comment has been minimized.
This comment has been minimized.
|
Huzzah! This RFC has been merged! Tracking issue: rust-lang/rust#54503 |
myrrlyn commentedApr 2, 2018
•
edited by Centril
This RFC makes two additions to the lint attributes in Rust code:
reasonfield to the attributes that permits custom text when renderingexpectlint attribute that acts as#[allow], but raises a lint when the lint it wants to allow is not raised.Rendered
Tracking issue