-
Notifications
You must be signed in to change notification settings - Fork 13.4k
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 5 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
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
11 changes: 11 additions & 0 deletions
11
src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs
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() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/lint/force-warn/force-allowed-by-default-lint.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: hidden lifetime parameters in types are deprecated | ||
--> $DIR/force-allowed-by-default-lint.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 | ||
|
9 changes: 9 additions & 0 deletions
9
src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs
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 const_err | ||
// check-pass | ||
|
||
#![allow(const_err)] | ||
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() {} |
14 changes: 14 additions & 0 deletions
14
src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.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,14 @@ | ||
warning: any use of this value will cause an error | ||
--> $DIR/force-allowed-deny-by-default-lint.rs:5:16 | ||
| | ||
LL | const C: i32 = 1 / 0; | ||
| ---------------^^^^^- | ||
| | | ||
| attempt to divide `1_i32` by zero | ||
| | ||
= 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 a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
|
||
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,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-lint-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-lint-allow-all-warnings.rs:6:4 | ||
| | ||
LL | fn dead_function() {} | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: Warning forced by `force-warns` commandline option | ||
|
||
warning: 1 warning emitted | ||
|
9 changes: 9 additions & 0 deletions
9
src/test/ui/lint/force-warn/force-lint-group-allow-all-warnings.rs
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 nonstandard_style | ||
// check-pass | ||
|
||
#![allow(warnings)] | ||
|
||
pub fn FUNCTION() {} | ||
//~^ WARN function `FUNCTION` should have a snake case name | ||
|
||
fn main() {} |
Oops, something went wrong.
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.