Skip to content

Commit 0d2fd70

Browse files
committed
Improve force-warn tests
1 parent cbe3afe commit 0d2fd70

28 files changed

+114
-11
lines changed

src/test/ui/lint/force-warn/force-lint-allow-all-warnings.rs renamed to src/test/ui/lint/force-warn/allow-warnings.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// --force-warn $LINT causes $LINT (which is warn-by-default) to warn
2+
// despite allowing all warnings in module
13
// compile-flags: --force-warn dead_code -Zunstable-options
24
// check-pass
35

src/test/ui/lint/force-warn/force-allowed-warning.stderr renamed to src/test/ui/lint/force-warn/allow-warnings.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: function is never used: `dead_function`
2-
--> $DIR/force-allowed-warning.rs:6:4
2+
--> $DIR/allow-warnings.rs:8:4
33
|
44
LL | fn dead_function() {}
55
| ^^^^^^^^^^^^^

src/test/ui/lint/force-warn/force-allowed-by-default-lint.rs renamed to src/test/ui/lint/force-warn/allowed-by-default-lint.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// --force-warn $LINT causes $LINT (which is allow-by-default) to warn
12
// compile-flags: --force-warn elided_lifetimes_in_paths -Zunstable-options
23
// check-pass
34

src/test/ui/lint/force-warn/force-allowed-by-default-lint.stderr renamed to src/test/ui/lint/force-warn/allowed-by-default-lint.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: hidden lifetime parameters in types are deprecated
2-
--> $DIR/force-allowed-by-default-lint.rs:8:12
2+
--> $DIR/allowed-by-default-lint.rs:9:12
33
|
44
LL | fn foo(x: &Foo) {}
55
| ^^^- help: indicate the anonymous lifetime: `<'_>`
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// --force-warn $LINT causes $LINT (which is deny-by-default) to warn
2+
// despite $LINT being allowed on command line
3+
// compile-flags: -A const_err --force-warn const_err -Zunstable-options
4+
// check-pass
5+
6+
const C: i32 = 1 / 0;
7+
//~^ WARN any use of this value will cause an error
8+
//~| WARN this was previously accepted by the compiler
9+
10+
fn main() {}

src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.stderr renamed to src/test/ui/lint/force-warn/allowed-cli-deny-by-default-lint.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: any use of this value will cause an error
2-
--> $DIR/force-allowed-deny-by-default-lint.rs:5:16
2+
--> $DIR/allowed-cli-deny-by-default-lint.rs:6:16
33
|
44
LL | const C: i32 = 1 / 0;
55
| ---------------^^^^^-

src/test/ui/lint/force-warn/force-allowed-deny-by-default-lint.rs renamed to src/test/ui/lint/force-warn/allowed-deny-by-default-lint.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// --force-warn $LINT causes $LINT (which is deny-by-default) to warn
2+
// despite $LINT being allowed in module
13
// compile-flags: --force-warn const_err -Zunstable-options
24
// check-pass
35

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: any use of this value will cause an error
2+
--> $DIR/allowed-deny-by-default-lint.rs:7:16
3+
|
4+
LL | const C: i32 = 1 / 0;
5+
| ---------------^^^^^-
6+
| |
7+
| attempt to divide `1_i32` by zero
8+
|
9+
= note: requested on the command line with `--force-warn const-err`
10+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
11+
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
12+
13+
warning: 1 warning emitted
14+

src/test/ui/lint/force-warn/force-lint-in-allowed-group.rs renamed to src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// --force-warn $LINT causes $LINT (which is warn-by-default) to warn
2+
// despite $LINT_GROUP (which contains $LINT) being allowed
13
// compile-flags: --force-warn bare_trait_objects -Zunstable-options
24
// check-pass
35

src/test/ui/lint/force-warn/force-lint-in-allowed-group.stderr renamed to src/test/ui/lint/force-warn/allowed-group-warn-by-default-lint.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: trait objects without an explicit `dyn` are deprecated
2-
--> $DIR/force-lint-in-allowed-group.rs:8:25
2+
--> $DIR/allowed-group-warn-by-default-lint.rs:10:25
33
|
44
LL | pub fn function(_x: Box<SomeTrait>) {}
55
| ^^^^^^^^^ help: use `dyn`: `dyn SomeTrait`

0 commit comments

Comments
 (0)