Rename force-warns to force-warn
This commit is contained in:
parent
da7d405357
commit
800c5f9202
34 changed files with 43 additions and 43 deletions
|
@ -370,7 +370,7 @@ impl LintStore {
|
||||||
match level {
|
match level {
|
||||||
Level::Allow => "-A",
|
Level::Allow => "-A",
|
||||||
Level::Warn => "-W",
|
Level::Warn => "-W",
|
||||||
Level::ForceWarn => "--force-warns",
|
Level::ForceWarn => "--force-warn",
|
||||||
Level::Deny => "-D",
|
Level::Deny => "-D",
|
||||||
Level::Forbid => "-F",
|
Level::Forbid => "-F",
|
||||||
},
|
},
|
||||||
|
|
|
@ -64,7 +64,7 @@ impl Level {
|
||||||
match self {
|
match self {
|
||||||
Level::Allow => "allow",
|
Level::Allow => "allow",
|
||||||
Level::Warn => "warn",
|
Level::Warn => "warn",
|
||||||
Level::ForceWarn => "force-warns",
|
Level::ForceWarn => "force-warn",
|
||||||
Level::Deny => "deny",
|
Level::Deny => "deny",
|
||||||
Level::Forbid => "forbid",
|
Level::Forbid => "forbid",
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ pub fn struct_lint_level<'s, 'd>(
|
||||||
Level::Deny => "-D",
|
Level::Deny => "-D",
|
||||||
Level::Forbid => "-F",
|
Level::Forbid => "-F",
|
||||||
Level::Allow => "-A",
|
Level::Allow => "-A",
|
||||||
Level::ForceWarn => "--force-warns",
|
Level::ForceWarn => "--force-warn",
|
||||||
};
|
};
|
||||||
let hyphen_case_lint_name = name.replace("_", "-");
|
let hyphen_case_lint_name = name.replace("_", "-");
|
||||||
if lint_flag_val.as_str() == name {
|
if lint_flag_val.as_str() == name {
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> {
|
||||||
),
|
),
|
||||||
opt::multi_s(
|
opt::multi_s(
|
||||||
"",
|
"",
|
||||||
"force-warns",
|
"force-warn",
|
||||||
"Specifiy lints that should warn even if \
|
"Specifiy lints that should warn even if \
|
||||||
they are allowed somewhere else",
|
they are allowed somewhere else",
|
||||||
"LINT",
|
"LINT",
|
||||||
|
@ -1175,11 +1175,11 @@ pub fn get_cmd_lint_options(
|
||||||
let mut lint_opts_with_position = vec![];
|
let mut lint_opts_with_position = vec![];
|
||||||
let mut describe_lints = false;
|
let mut describe_lints = false;
|
||||||
|
|
||||||
if !debugging_opts.unstable_options && matches.opt_present("force-warns") {
|
if !debugging_opts.unstable_options && matches.opt_present("force-warn") {
|
||||||
early_error(
|
early_error(
|
||||||
error_format,
|
error_format,
|
||||||
"the `-Z unstable-options` flag must also be passed to enable \
|
"the `-Z unstable-options` flag must also be passed to enable \
|
||||||
the flag `--force-warns=lints`",
|
the flag `--force-warn=lints`",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# `force-warns`
|
# `force-warn`
|
||||||
|
|
||||||
The tracking issue for this feature is: [#85512](https://github.com/rust-lang/rust/issues/85512).
|
The tracking issue for this feature is: [#85512](https://github.com/rust-lang/rust/issues/85512).
|
||||||
|
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
This feature allows you to cause any lint to produce a warning even if the lint has a different level by default or another level is set somewhere else. For instance, the `force-warns` option can be used to make a lint (e.g., `dead_code`) produce a warning even if that lint is allowed in code with `#![allow(dead_code)]`.
|
This feature allows you to cause any lint to produce a warning even if the lint has a different level by default or another level is set somewhere else. For instance, the `force-warn` option can be used to make a lint (e.g., `dead_code`) produce a warning even if that lint is allowed in code with `#![allow(dead_code)]`.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
|
@ -18,4 +18,4 @@ fn dead_function() {}
|
||||||
fn main() {}
|
fn main() {}
|
||||||
```
|
```
|
||||||
|
|
||||||
We can force a warning to be produced by providing `--force-warns dead_code` to rustc.
|
We can force a warning to be produced by providing `--force-warn dead_code` to rustc.
|
|
@ -511,10 +511,10 @@ fn opts() -> Vec<RustcOptGroup> {
|
||||||
"LEVEL",
|
"LEVEL",
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
unstable("force-warns", |o| {
|
unstable("force-warn", |o| {
|
||||||
o.optopt(
|
o.optopt(
|
||||||
"",
|
"",
|
||||||
"force-warns",
|
"force-warn",
|
||||||
"Lints that will warn even if allowed somewhere else",
|
"Lints that will warn even if allowed somewhere else",
|
||||||
"LINTS",
|
"LINTS",
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(RUSTDOC) --output-format=json x.html 2>&1 | diff - output-format-json.stderr
|
$(RUSTDOC) --output-format=json x.html 2>&1 | diff - output-format-json.stderr
|
||||||
$(RUSTC) --force-warns dead_code x.rs 2>&1 | diff - force-warns.stderr
|
$(RUSTC) --force-warn dead_code x.rs 2>&1 | diff - force-warn.stderr
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
error: the `-Z unstable-options` flag must also be passed to enable the flag `--force-warns=lints`
|
error: the `-Z unstable-options` flag must also be passed to enable the flag `--force-warn=lints`
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: extern declarations without an explicit ABI are deprecated
|
||||||
LL | extern fn foo() {}
|
LL | extern fn foo() {}
|
||||||
| ^^^^^^^^^^^^^^^ ABI should be specified here
|
| ^^^^^^^^^^^^^^^ ABI should be specified here
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns missing-abi`
|
= note: requested on the command line with `--force-warn missing-abi`
|
||||||
= help: the default ABI is C
|
= help: the default ABI is C
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//
|
//
|
||||||
//[warn_deny] compile-flags: --warn missing_abi --deny missing_abi
|
//[warn_deny] compile-flags: --warn missing_abi --deny missing_abi
|
||||||
//[forbid_warn] compile-flags: --warn missing_abi --forbid 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] compile-flags: -Z unstable-options --force-warn missing_abi --allow missing_abi
|
||||||
//[force_warn_deny] check-pass
|
//[force_warn_deny] check-pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Checks that rustc correctly errors when passed an invalid lint with
|
// Checks that rustc correctly errors when passed an invalid lint with
|
||||||
// `--force-warns`. This is a regression test for issue #86958.
|
// `--force-warn`. This is a regression test for issue #86958.
|
||||||
//
|
//
|
||||||
// compile-flags: -Z unstable-options --force-warns foo-qux
|
// compile-flags: -Z unstable-options --force-warn foo-qux
|
||||||
// error-pattern: unknown lint: `foo_qux`
|
// error-pattern: unknown lint: `foo_qux`
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
error[E0602]: unknown lint: `foo_qux`
|
error[E0602]: unknown lint: `foo_qux`
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
|
||||||
|
|
||||||
error[E0602]: unknown lint: `foo_qux`
|
error[E0602]: unknown lint: `foo_qux`
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
|
||||||
|
|
||||||
error[E0602]: unknown lint: `foo_qux`
|
error[E0602]: unknown lint: `foo_qux`
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns foo_qux`
|
= note: requested on the command line with `--force-warn foo_qux`
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns elided_lifetimes_in_paths -Zunstable-options
|
// compile-flags: --force-warn elided_lifetimes_in_paths -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
struct Foo<'a> {
|
struct Foo<'a> {
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: hidden lifetime parameters in types are deprecated
|
||||||
LL | fn foo(x: &Foo) {}
|
LL | fn foo(x: &Foo) {}
|
||||||
| ^^^- help: indicate the anonymous lifetime: `<'_>`
|
| ^^^- help: indicate the anonymous lifetime: `<'_>`
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns elided-lifetimes-in-paths`
|
= note: requested on the command line with `--force-warn elided-lifetimes-in-paths`
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns const_err -Zunstable-options
|
// compile-flags: --force-warn const_err -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(const_err)]
|
#![allow(const_err)]
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | const C: i32 = 1 / 0;
|
||||||
| |
|
| |
|
||||||
| attempt to divide `1_i32` by zero
|
| attempt to divide `1_i32` by zero
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns const-err`
|
= note: requested on the command line with `--force-warn const-err`
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns dead_code -Zunstable-options
|
// compile-flags: --force-warn dead_code -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: function is never used: `dead_function`
|
||||||
LL | fn dead_function() {}
|
LL | fn dead_function() {}
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns dead-code`
|
= note: requested on the command line with `--force-warn dead-code`
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns const_err -Zunstable-options
|
// compile-flags: --force-warn const_err -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
const C: i32 = 1 / 0;
|
const C: i32 = 1 / 0;
|
||||||
|
|
|
@ -6,7 +6,7 @@ LL | const C: i32 = 1 / 0;
|
||||||
| |
|
| |
|
||||||
| attempt to divide `1_i32` by zero
|
| attempt to divide `1_i32` by zero
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns const-err`
|
= note: requested on the command line with `--force-warn const-err`
|
||||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns dead_code -Zunstable-options
|
// compile-flags: --force-warn dead_code -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: function is never used: `dead_function`
|
||||||
LL | fn dead_function() {}
|
LL | fn dead_function() {}
|
||||||
| ^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns dead-code`
|
= note: requested on the command line with `--force-warn dead-code`
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns nonstandard_style -Zunstable-options
|
// compile-flags: --force-warn nonstandard_style -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: function `FUNCTION` should have a snake case name
|
||||||
LL | pub fn FUNCTION() {}
|
LL | pub fn FUNCTION() {}
|
||||||
| ^^^^^^^^ help: convert the identifier to snake case: `function`
|
| ^^^^^^^^ help: convert the identifier to snake case: `function`
|
||||||
|
|
|
|
||||||
= note: `--force-warns non-snake-case` implied by `--force-warns nonstandard-style`
|
= note: `--force-warn non-snake-case` implied by `--force-warn nonstandard-style`
|
||||||
|
|
||||||
warning: 1 warning emitted
|
warning: 1 warning emitted
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns bare_trait_objects -Zunstable-options
|
// compile-flags: --force-warn bare_trait_objects -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(rust_2018_idioms)]
|
#![allow(rust_2018_idioms)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: trait objects without an explicit `dyn` are deprecated
|
||||||
LL | pub fn function(_x: Box<SomeTrait>) {}
|
LL | pub fn function(_x: Box<SomeTrait>) {}
|
||||||
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns bare-trait-objects`
|
= note: requested on the command line with `--force-warn bare-trait-objects`
|
||||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --cap-lints allow --force-warns bare_trait_objects -Zunstable-options
|
// compile-flags: --cap-lints allow --force-warn bare_trait_objects -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
pub trait SomeTrait {}
|
pub trait SomeTrait {}
|
|
@ -1,10 +1,10 @@
|
||||||
warning: trait objects without an explicit `dyn` are deprecated
|
warning: trait objects without an explicit `dyn` are deprecated
|
||||||
--> $DIR/force-warns-cap-lints-allow.rs:6:25
|
--> $DIR/force-warn-cap-lints-allow.rs:6:25
|
||||||
|
|
|
|
||||||
LL | pub fn function(_x: Box<SomeTrait>) {}
|
LL | pub fn function(_x: Box<SomeTrait>) {}
|
||||||
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
||||||
|
|
|
|
||||||
= note: requested on the command line with `--force-warns bare-trait-objects`
|
= note: requested on the command line with `--force-warn bare-trait-objects`
|
||||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --cap-lints warn --force-warns rust-2021-compatibility -Zunstable-options
|
// compile-flags: --cap-lints warn --force-warn rust-2021-compatibility -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
#![allow(ellipsis_inclusive_range_patterns)]
|
#![allow(ellipsis_inclusive_range_patterns)]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: `...` range patterns are deprecated
|
||||||
LL | 0...100 => true,
|
LL | 0...100 => true,
|
||||||
| ^^^ help: use `..=` for an inclusive range
|
| ^^^ help: use `..=` for an inclusive range
|
||||||
|
|
|
|
||||||
= note: `--force-warns ellipsis-inclusive-range-patterns` implied by `--force-warns rust-2021-compatibility`
|
= note: `--force-warn ellipsis-inclusive-range-patterns` implied by `--force-warn rust-2021-compatibility`
|
||||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns rust-2018-idioms -Zunstable-options
|
// compile-flags: --force-warn rust-2018-idioms -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(bare_trait_objects)]
|
#![allow(bare_trait_objects)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: trait objects without an explicit `dyn` are deprecated
|
||||||
LL | pub fn function(_x: Box<SomeTrait>) {}
|
LL | pub fn function(_x: Box<SomeTrait>) {}
|
||||||
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
||||||
|
|
|
|
||||||
= note: `--force-warns bare-trait-objects` implied by `--force-warns rust-2018-idioms`
|
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
|
||||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// compile-flags: --force-warns rust_2018_idioms -Zunstable-options
|
// compile-flags: --force-warn rust_2018_idioms -Zunstable-options
|
||||||
// check-pass
|
// check-pass
|
||||||
|
|
||||||
#![allow(rust_2018_idioms)]
|
#![allow(rust_2018_idioms)]
|
||||||
|
|
|
@ -4,7 +4,7 @@ warning: trait objects without an explicit `dyn` are deprecated
|
||||||
LL | pub fn function(_x: Box<SomeTrait>) {}
|
LL | pub fn function(_x: Box<SomeTrait>) {}
|
||||||
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`
|
||||||
|
|
|
|
||||||
= note: `--force-warns bare-trait-objects` implied by `--force-warns rust-2018-idioms`
|
= note: `--force-warn bare-trait-objects` implied by `--force-warn rust-2018-idioms`
|
||||||
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
|
||||||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue