-
Notifications
You must be signed in to change notification settings - Fork 13.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
Make --force-warns
a normal lint level option
#86970
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
|
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 | ||
|
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() {} |
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 | ||
|
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() {} |
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` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any idea why this error gets emitted multiple times? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This happens for some other cases as well. I think it's a product of the way the tests are run, though I'm not totally sure? |
||
| | ||
= 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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this behavior documented anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of. However, the fact that forbid currently overrides the others isn't specified, and
force-warns
isn't documented at all because it's unstable. Given that the behavior is intrinsic to the definition of these lint levels, I don't think it's too surprising. It might be worth documenting it in the long run though?