forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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 rust-lang#88134 - rylev:force-warn-improvements, r=niko…
…matsakis Force warn improvements As part of stablization of the `--force-warn` option (rust-lang#86516) I've made the following changes: * Error when the `warnings` lint group is based to the `--force-warn` option * Tests have been updated to make it easier to understand the semantics of `--force-warn` r? `@nikomatsakis`
- Loading branch information
Showing
32 changed files
with
139 additions
and
13 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
2 changes: 2 additions & 0 deletions
2
...rce-warn/force-lint-allow-all-warnings.rs → ...test/ui/lint/force-warn/allow-warnings.rs
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
2 changes: 1 addition & 1 deletion
2
...t/force-warn/force-allowed-warning.stderr → .../ui/lint/force-warn/allow-warnings.stderr
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
1 change: 1 addition & 0 deletions
1
...rce-warn/force-allowed-by-default-lint.rs → ...int/force-warn/allowed-by-default-lint.rs
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
2 changes: 1 addition & 1 deletion
2
...warn/force-allowed-by-default-lint.stderr → ...force-warn/allowed-by-default-lint.stderr
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
10 changes: 10 additions & 0 deletions
10
src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.rs
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,10 @@ | ||
// --force-warn $LINT causes $LINT (which is deny-by-default) to warn | ||
// despite $LINT being allowed on command line | ||
// compile-flags: -A const_err --force-warn const_err -Zunstable-options | ||
// check-pass | ||
|
||
const C: i32 = 1 / 0; | ||
//~^ WARN any use of this value will cause an error | ||
//~| WARN this was previously accepted by the compiler | ||
|
||
fn main() {} |
2 changes: 1 addition & 1 deletion
2
...force-allowed-deny-by-default-lint.stderr → ...n/allowed-cli-deny-by-default-lint.stderr
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
2 changes: 2 additions & 0 deletions
2
...arn/force-allowed-deny-by-default-lint.rs → ...orce-warn/allowed-deny-by-default-lint.rs
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
14 changes: 14 additions & 0 deletions
14
src/test/ui/lint/force-warn/allowed-deny-by-default-lint.stderr
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,14 @@ | ||
warning: any use of this value will cause an error | ||
--> $DIR/allowed-deny-by-default-lint.rs:7:16 | ||
| | ||
LL | const C: i32 = 1 / 0; | ||
| ---------------^^^^^- | ||
| | | ||
| attempt to divide `1_i32` by zero | ||
| | ||
= 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! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
|
||
warning: 1 warning emitted | ||
|
2 changes: 2 additions & 0 deletions
2
...force-warn/force-lint-in-allowed-group.rs → ...arn/allowed-group-warn-by-default-lint.rs
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
2 changes: 1 addition & 1 deletion
2
...e-warn/force-lint-in-allowed-group.stderr → ...allowed-group-warn-by-default-lint.stderr
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
2 changes: 2 additions & 0 deletions
2
.../lint/force-warn/force-allowed-warning.rs → ...orce-warn/allowed-warn-by-default-lint.rs
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
2 changes: 1 addition & 1 deletion
2
...warn/force-lint-allow-all-warnings.stderr → ...-warn/allowed-warn-by-default-lint.stderr
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
2 changes: 2 additions & 0 deletions
2
.../force-warn/force-warn-cap-lints-allow.rs → ...est/ui/lint/force-warn/cap-lints-allow.rs
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
2 changes: 1 addition & 1 deletion
2
...ce-warn/force-warn-cap-lints-allow.stderr → ...ui/lint/force-warn/cap-lints-allow.stderr
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
2 changes: 2 additions & 0 deletions
2
...t/force-warn/force-warn-cap-lints-warn.rs → ...ints-warn-allowed-warn-by-default-lint.rs
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
2 changes: 1 addition & 1 deletion
2
...rce-warn/force-warn-cap-lints-warn.stderr → ...-warn-allowed-warn-by-default-lint.stderr
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
1 change: 1 addition & 0 deletions
1
.../force-warn/force-deny-by-default-lint.rs → ...i/lint/force-warn/deny-by-default-lint.rs
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
2 changes: 1 addition & 1 deletion
2
...ce-warn/force-deny-by-default-lint.stderr → ...nt/force-warn/deny-by-default-lint.stderr
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
3 changes: 3 additions & 0 deletions
3
...rn/force-lint-group-allow-all-warnings.rs → ...t/force-warn/lint-group-allow-warnings.rs
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
2 changes: 1 addition & 1 deletion
2
...orce-lint-group-allow-all-warnings.stderr → ...rce-warn/lint-group-allow-warnings.stderr
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
12 changes: 12 additions & 0 deletions
12
src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.rs
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,12 @@ | ||
// --force-warn $LINT_GROUP causes $LINT (which is warn-by-default) to warn | ||
// despite $LINT being allowed on command line | ||
// compile-flags: -A bare-trait-objects --force-warn rust-2018-idioms -Zunstable-options | ||
// check-pass | ||
|
||
pub trait SomeTrait {} | ||
|
||
pub fn function(_x: Box<SomeTrait>) {} | ||
//~^ WARN trait objects without an explicit `dyn` are deprecated | ||
//~| WARN this is accepted in the current edition | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/lint/force-warn/lint-group-allowed-cli-warn-by-default-lint.stderr
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,12 @@ | ||
warning: trait objects without an explicit `dyn` are deprecated | ||
--> $DIR/lint-group-allowed-cli-warn-by-default-lint.rs:8:25 | ||
| | ||
LL | pub fn function(_x: Box<SomeTrait>) {} | ||
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ||
| | ||
= 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! | ||
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html> | ||
|
||
warning: 1 warning emitted | ||
|
2 changes: 2 additions & 0 deletions
2
...st/ui/lint/force-warn/force-warn-group.rs → ...rce-warn/lint-group-allowed-lint-group.rs
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
2 changes: 1 addition & 1 deletion
2
...i/lint/force-warn/force-warn-group.stderr → ...warn/lint-group-allowed-lint-group.stderr
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
2 changes: 2 additions & 0 deletions
2
...ce-warn/force-warn-group-allow-warning.rs → ...int-group-allowed-warn-by-default-lint.rs
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
2 changes: 1 addition & 1 deletion
2
...arn/force-warn-group-allow-warning.stderr → ...group-allowed-warn-by-default-lint.stderr
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
18 changes: 18 additions & 0 deletions
18
src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.rs
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,18 @@ | ||
// --force-warn $LINT causes $LINT (which is warn-by-default) to warn | ||
// despite being allowed in one submodule (but not the other) | ||
// compile-flags: --force-warn dead_code -Zunstable-options | ||
// check-pass | ||
|
||
mod one { | ||
#![allow(dead_code)] | ||
|
||
fn dead_function() {} | ||
//~^ WARN function is never used | ||
} | ||
|
||
mod two { | ||
fn dead_function() {} | ||
//~^ WARN function is never used | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/lint/force-warn/warn-by-default-lint-two-modules.stderr
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,16 @@ | ||
warning: function is never used: `dead_function` | ||
--> $DIR/warn-by-default-lint-two-modules.rs:9:8 | ||
| | ||
LL | fn dead_function() {} | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: requested on the command line with `--force-warn dead-code` | ||
|
||
warning: function is never used: `dead_function` | ||
--> $DIR/warn-by-default-lint-two-modules.rs:14:8 | ||
| | ||
LL | fn dead_function() {} | ||
| ^^^^^^^^^^^^^ | ||
|
||
warning: 2 warnings 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,5 @@ | ||
// --force-warn warnings is an error | ||
// compile-flags: --force-warn warnings -Zunstable-options | ||
// error-pattern: `warnings` lint group is not supported | ||
|
||
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,9 @@ | ||
error[E0602]: `warnings` lint group is not supported with ´--force-warn´ | ||
|
||
error[E0602]: `warnings` lint group is not supported with ´--force-warn´ | ||
|
||
error[E0602]: `warnings` lint group is not supported with ´--force-warn´ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0602`. |