-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Support for force-warns #85788
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
Merged
Merged
Support for force-warns #85788
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
69a19bf
Initial support for force-warns
rylev 4675690
Fix issues and add test
rylev 3b206b7
Force warn on lint groups as well
rylev 8d4841c
Add final test
rylev e3e31a1
Add missing stderr file
rylev dc2db73
Add deny-by-default test
rylev ab41931
Add a page on force-warns in unstable book
rylev 81da9b4
Add run-make test testing flag stability
rylev 896898e
Update tests with new casing
rylev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// compile-flags: --force-warns dead_code | ||
// check-pass | ||
|
||
#![allow(warnings)] | ||
|
||
fn dead_function() {} | ||
//~^ WARN function is never used | ||
|
||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/lint/force-warn/force-allow-all-warnings.stderr
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
warning: function is never used: `dead_function` | ||
--> $DIR/force-allow-all-warnings.rs:6:4 | ||
| | ||
LL | fn dead_function() {} | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: Warning forced by `force-warns` commandline option | ||
|
||
warning: 1 warning emitted | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// compile-flags: --force-warns elided_lifetimes_in_paths | ||
// check-pass | ||
|
||
struct Foo<'a> { | ||
x: &'a u32, | ||
} | ||
|
||
fn foo(x: &Foo) {} | ||
//~^ WARN hidden lifetime parameters in types are deprecated | ||
|
||
fn main() {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
warning: hidden lifetime parameters in types are deprecated | ||
--> $DIR/force-allow-by-default.rs:8:12 | ||
| | ||
LL | fn foo(x: &Foo) {} | ||
| ^^^- help: indicate the anonymous lifetime: `<'_>` | ||
| | ||
= note: Warning forced by `force-warns` commandline option | ||
|
||
warning: 1 warning emitted | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// ignore-test | ||
// compile-flags: --force-warns arithmetic_overflow | ||
// check-pass | ||
|
||
#![allow(arithmetic_overflow)] | ||
|
||
fn main() { | ||
1_i32 << 32; | ||
//~^ WARN this arithmetic operation will overflow | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// compile-flags: --force-warns bare_trait_objects | ||
// check-pass | ||
|
||
#![allow(rust_2018_idioms)] | ||
|
||
pub trait SomeTrait {} | ||
|
||
pub fn function(_x: Box<SomeTrait>) {} | ||
//~^ WARN trait objects without an explicit `dyn` are deprecated | ||
//~| WARN this was previously accepted by the compiler | ||
|
||
fn main() {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
warning: trait objects without an explicit `dyn` are deprecated | ||
--> $DIR/force-allowed-group.rs:8:25 | ||
| | ||
LL | pub fn function(_x: Box<SomeTrait>) {} | ||
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait` | ||
| | ||
= note: Warning forced by `force-warns` commandline option | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2021 edition! | ||
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165> | ||
|
||
warning: 1 warning emitted | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// compile-flags: --force-warns dead_code | ||
// check-pass | ||
|
||
#![allow(dead_code)] | ||
|
||
fn dead_function() {} | ||
//~^ WARN function is never used | ||
|
||
fn main() {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
warning: function is never used: `dead_function` | ||
--> $DIR/force-allowed-warning.rs:6:4 | ||
| | ||
LL | fn dead_function() {} | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: Warning forced by `force-warns` commandline option | ||
|
||
warning: 1 warning emitted | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// ignore-test | ||
// compile-flags: --force-warns rust_2018_idioms | ||
// check-pass | ||
|
||
#![allow(rust_2018_idioms)] | ||
|
||
pub trait SomeTrait {} | ||
|
||
pub fn function(_x: Box<SomeTrait>) {} | ||
//~^ WARN trait objects without an explicit `dyn` are deprecated | ||
//~| WARN this was previously accepted by the compiler | ||
|
||
fn main() {} |
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.
Uh oh!
There was an error while loading. Please reload this page.