-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #86970 - inquisitivecrystal:force-warn, r=davidtwco
Make `--force-warns` a normal lint level option Now that `ForceWarn` is a lint level, there's no reason `--force-warns` should be treated differently from other options that set lint levels. This merges the `ForceWarn` handling in with the other lint level command line options. It also unifies all of the relevant selection logic in `compiler/rustc_lint/src/levels.rs`, rather than having some of it weirdly elsewhere. Fixes #86958, which arose from the special-cased handling of `ForceWarn` having had an error in it.
- Loading branch information
Showing
10 changed files
with
91 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: extern declarations without an explicit ABI are deprecated | ||
--> $DIR/cli-lint-override.rs:12:1 | ||
| | ||
LL | extern fn foo() {} | ||
| ^^^^^^^^^^^^^^^ ABI should be specified here | ||
| | ||
= note: requested on the command line with `-F missing-abi` | ||
= help: the default ABI is C | ||
|
||
error: aborting due to previous error | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
warning: extern declarations without an explicit ABI are deprecated | ||
--> $DIR/cli-lint-override.rs:12:1 | ||
| | ||
LL | extern fn foo() {} | ||
| ^^^^^^^^^^^^^^^ ABI should be specified here | ||
| | ||
= note: requested on the command line with `--force-warns missing-abi` | ||
= help: the default ABI is C | ||
|
||
warning: 1 warning emitted | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Tests that subsequent lints specified via the command line override | ||
// each other, except for ForceWarn and Forbid, which cannot be overriden. | ||
// | ||
// revisions: warn_deny forbid_warn force_warn_deny | ||
// | ||
//[warn_deny] compile-flags: --warn missing_abi --deny missing_abi | ||
//[forbid_warn] compile-flags: --warn missing_abi --forbid missing_abi | ||
//[force_warn_deny] compile-flags: -Z unstable-options --force-warns missing_abi --allow missing_abi | ||
//[force_warn_deny] check-pass | ||
|
||
|
||
extern fn foo() {} | ||
//[warn_deny]~^ ERROR extern declarations without an explicit ABI are deprecated | ||
//[forbid_warn]~^^ ERROR extern declarations without an explicit ABI are deprecated | ||
//[force_warn_deny]~^^^ WARN extern declarations without an explicit ABI are deprecated | ||
|
||
fn main() {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error: extern declarations without an explicit ABI are deprecated | ||
--> $DIR/cli-lint-override.rs:12:1 | ||
| | ||
LL | extern fn foo() {} | ||
| ^^^^^^^^^^^^^^^ ABI should be specified here | ||
| | ||
= note: requested on the command line with `-D missing-abi` | ||
= help: the default ABI is C | ||
|
||
error: aborting due to previous error | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Checks that rustc correctly errors when passed an invalid lint with | ||
// `--force-warns`. This is a regression test for issue #86958. | ||
// | ||
// compile-flags: -Z unstable-options --force-warns foo-qux | ||
// error-pattern: unknown lint: `foo_qux` | ||
|
||
fn main() {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0602]: unknown lint: `foo_qux` | ||
| | ||
= note: requested on the command line with `--force-warns foo_qux` | ||
|
||
error[E0602]: unknown lint: `foo_qux` | ||
| | ||
= note: requested on the command line with `--force-warns foo_qux` | ||
|
||
error[E0602]: unknown lint: `foo_qux` | ||
| | ||
= note: requested on the command line with `--force-warns foo_qux` | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0602`. |