Skip to content

Commit e4e0f95

Browse files
committed
promoted_errors: warn -> deny.
1 parent e364eb4 commit e4e0f95

File tree

2 files changed

+36
-30
lines changed

2 files changed

+36
-30
lines changed
Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1-
#![warn(const_err)]
2-
3-
// compile-pass
41
// compile-flags: -O
2+
3+
#![deny(const_err)]
4+
55
fn main() {
66
println!("{}", 0u32 - 1);
77
let _x = 0u32 - 1;
8-
//~^ WARN const_err
8+
//~^ ERROR this expression will panic at runtime [const_err]
99
println!("{}", 1/(1-1));
10-
//~^ WARN const_err
10+
//~^ ERROR this expression will panic at runtime [const_err]
11+
//~| ERROR attempt to divide by zero [const_err]
12+
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
1113
let _x = 1/(1-1);
12-
//~^ WARN const_err
13-
//~| WARN const_err
14+
//~^ ERROR const_err
15+
//~| ERROR const_err
1416
println!("{}", 1/(false as u32));
15-
//~^ WARN const_err
17+
//~^ ERROR this expression will panic at runtime [const_err]
18+
//~| ERROR attempt to divide by zero [const_err]
19+
//~| ERROR reaching this expression at runtime will panic or abort [const_err]
1620
let _x = 1/(false as u32);
17-
//~^ WARN const_err
18-
//~| WARN const_err
21+
//~^ ERROR const_err
22+
//~| ERROR const_err
1923
}
Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,74 @@
1-
warning: this expression will panic at runtime
1+
error: this expression will panic at runtime
22
--> $DIR/promoted_errors.rs:7:14
33
|
44
LL | let _x = 0u32 - 1;
55
| ^^^^^^^^ attempt to subtract with overflow
66
|
77
note: lint level defined here
8-
--> $DIR/promoted_errors.rs:1:9
8+
--> $DIR/promoted_errors.rs:3:9
99
|
10-
LL | #![warn(const_err)]
10+
LL | #![deny(const_err)]
1111
| ^^^^^^^^^
1212

13-
warning: attempt to divide by zero
13+
error: attempt to divide by zero
1414
--> $DIR/promoted_errors.rs:9:20
1515
|
1616
LL | println!("{}", 1/(1-1));
1717
| ^^^^^^^
1818

19-
warning: this expression will panic at runtime
19+
error: this expression will panic at runtime
2020
--> $DIR/promoted_errors.rs:9:20
2121
|
2222
LL | println!("{}", 1/(1-1));
2323
| ^^^^^^^ attempt to divide by zero
2424

25-
warning: attempt to divide by zero
26-
--> $DIR/promoted_errors.rs:11:14
25+
error: attempt to divide by zero
26+
--> $DIR/promoted_errors.rs:13:14
2727
|
2828
LL | let _x = 1/(1-1);
2929
| ^^^^^^^
3030

31-
warning: this expression will panic at runtime
32-
--> $DIR/promoted_errors.rs:11:14
31+
error: this expression will panic at runtime
32+
--> $DIR/promoted_errors.rs:13:14
3333
|
3434
LL | let _x = 1/(1-1);
3535
| ^^^^^^^ attempt to divide by zero
3636

37-
warning: attempt to divide by zero
38-
--> $DIR/promoted_errors.rs:14:20
37+
error: attempt to divide by zero
38+
--> $DIR/promoted_errors.rs:16:20
3939
|
4040
LL | println!("{}", 1/(false as u32));
4141
| ^^^^^^^^^^^^^^^^
4242

43-
warning: this expression will panic at runtime
44-
--> $DIR/promoted_errors.rs:14:20
43+
error: this expression will panic at runtime
44+
--> $DIR/promoted_errors.rs:16:20
4545
|
4646
LL | println!("{}", 1/(false as u32));
4747
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
4848

49-
warning: attempt to divide by zero
50-
--> $DIR/promoted_errors.rs:16:14
49+
error: attempt to divide by zero
50+
--> $DIR/promoted_errors.rs:20:14
5151
|
5252
LL | let _x = 1/(false as u32);
5353
| ^^^^^^^^^^^^^^^^
5454

55-
warning: this expression will panic at runtime
56-
--> $DIR/promoted_errors.rs:16:14
55+
error: this expression will panic at runtime
56+
--> $DIR/promoted_errors.rs:20:14
5757
|
5858
LL | let _x = 1/(false as u32);
5959
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
6060

61-
warning: reaching this expression at runtime will panic or abort
62-
--> $DIR/promoted_errors.rs:14:20
61+
error: reaching this expression at runtime will panic or abort
62+
--> $DIR/promoted_errors.rs:16:20
6363
|
6464
LL | println!("{}", 1/(false as u32));
6565
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
6666

67-
warning: reaching this expression at runtime will panic or abort
67+
error: reaching this expression at runtime will panic or abort
6868
--> $DIR/promoted_errors.rs:9:20
6969
|
7070
LL | println!("{}", 1/(1-1));
7171
| ^^^^^^^ attempt to divide by zero
7272

73+
error: aborting due to 11 previous errors
74+

0 commit comments

Comments
 (0)