rustc_session: forbid lints override regardless of position#70918
Merged
bors merged 1 commit intorust-lang:masterfrom Apr 9, 2020
Merged
rustc_session: forbid lints override regardless of position#70918bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
r? @davidtwco (rust_highfive has picked a reviewer for you, use r? to override) |
3b7853f to
2a2a21d
Compare
2a2a21d to
f03db79
Compare
davidtwco
approved these changes
Apr 8, 2020
Member
|
r=me if you're happy with this (and unmark as a draft) |
Contributor
Author
Member
|
@bors r+ |
Collaborator
|
📌 Commit f03db79 has been approved by |
Collaborator
|
🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened |
Member
|
TBH I think this is the wrong way to fix the problem. Given that the issue affects both in-code and CLI argument lint levels, I suspect that whatever fixes the former will also fix the latter. This PR adds a temporary hack that most likely can be removed again once in-code lint levels work as expected. |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 9, 2020
Rollup of 7 pull requests Successful merges: - rust-lang#67705 (Use unrolled loop for searching NULL in [u16] on Windows) - rust-lang#70367 (save/restore `pessimistic_yield` when entering bodies) - rust-lang#70822 (Don't lint for self-recursion when the function can diverge) - rust-lang#70868 (rustc_codegen_ssa: Refactor construction of linker arguments) - rust-lang#70896 (Implement Chain with Option fuses) - rust-lang#70916 (Support `#[track_caller]` on functions in `extern "Rust" { ... }`) - rust-lang#70918 (rustc_session: forbid lints override regardless of position) Failed merges: r? @ghost
RalfJung
reviewed
Apr 9, 2020
| for (passed_arg_pos, lint_name) in matches.opt_strs_pos(level.as_str()) { | ||
| let arg_pos = if let lint::Forbid = level { | ||
| // forbid is always specified last, so it can't be overridden | ||
| usize::max_value() |
Member
There was a problem hiding this comment.
Btw, this could be usize::MAX now. :)
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this pull request
Apr 9, 2020
…ochenkov rustc_session CLI lint parsing: mark a temporary hack as such This code was added in rust-lang#70918, but it should not be necessary any more once `forbid` works as expected for in-code attributes. Cc @tobithiel @davidtwco
Centril
added a commit
to Centril/rust
that referenced
this pull request
Apr 10, 2020
…ochenkov rustc_session CLI lint parsing: mark a temporary hack as such This code was added in rust-lang#70918, but it should not be necessary any more once `forbid` works as expected for in-code attributes. Cc @tobithiel @davidtwco
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this pull request
Nov 14, 2020
Previously, cap-lints was ignored when checking the previous forbid level, which meant that it was a hard error to do so. This is different from the normal behavior of lints, which are silenced by cap-lints; if the forbid would not take effect regardless, there is not much point in complaining about the fact that we are reducing its level. It might be considered a bug that even `--cap-lints deny` would suffice to silence the error on overriding forbid, depending on if one cares about failing the build or precisely forbid being set. But setting cap-lints to deny is quite odd and not really done in practice, so we don't try to handle it specially. This also unifies the code paths for nested and same-level scopes. However, the special case for CLI lint flags is left in place (introduced by rust-lang#70918) to fix the regression noted in rust-lang#70819. That means that CLI flags do not lint on forbid being overridden by a non-forbid level. It is unclear whether this is a bug or a desirable feature, but it is certainly inconsistent. CLI flags are a sufficiently different "type" of place though that this is deemed out of scope for this commit.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 2, 2020
…kfelix Use true previous lint level when detecting overriden forbids Previously, cap-lints was ignored when checking the previous forbid level, which meant that it was a hard error to do so. This is different from the normal behavior of lints, which are silenced by cap-lints; if the forbid would not take effect regardless, there is not much point in complaining about the fact that we are reducing its level. It might be considered a bug that even `--cap-lints deny` would suffice to silence the error on overriding forbid, depending on if one cares about failing the build or precisely forbid being set. But setting cap-lints to deny is quite odd and not really done in practice, so we don't try to handle it specially. This also unifies the code paths for nested and same-level scopes. However, the special case for CLI lint flags is left in place (introduced by rust-lang#70918) to fix the regression noted in rust-lang#70819. That means that CLI flags do not lint on forbid being overridden by a non-forbid level. It is unclear whether this is a bug or a desirable feature, but it is certainly inconsistent. CLI flags are a sufficiently different "type" of place though that this is deemed out of scope for this commit. r? `@pnkfelix` perhaps? cc rust-lang#77713 -- not marking as "Fixes" because of the lack of proper unused attribute handling in this PR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the regression reported in #70819 for command line arguments, but does not address the source code flag regression.