Skip to content

Commit dc2db73

Browse files
committed
Add deny-by-default test
1 parent e3e31a1 commit dc2db73

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// compile-flags: --force-warns const_err
2+
// check-pass
3+
4+
const C: i32 = 1 / 0;
5+
//~^ WARN any use of this value will cause an error
6+
//~| WARN this was previously accepted by the compiler
7+
8+
fn main() {}
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/force-deny-by-default-lint.rs:4:16
3+
|
4+
LL | const C: i32 = 1 / 0;
5+
| ---------------^^^^^-
6+
| |
7+
| attempt to divide `1_i32` by zero
8+
|
9+
= note: Warning forced by `force-warns` commandline option
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+

0 commit comments

Comments
 (0)