Improve div by zero const eval errors
This commit is contained in:
parent
1f3cb926a2
commit
f66367dacc
7 changed files with 12 additions and 9 deletions
|
|
@ -2,7 +2,7 @@ error[E0080]: constant evaluation error
|
|||
--> $DIR/index_out_of_bound.rs:11:19
|
||||
|
|
||||
LL | static FOO: i32 = [][0];
|
||||
| ^^^^^ index out of bounds: the len is 0 but the index is 0 at $DIR/index_out_of_bound.rs:11:19: 11:24
|
||||
| ^^^^^ index out of bounds: the len is 0 but the index is 0
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ warning: constant evaluation error
|
|||
--> $DIR/promoted_errors.rs:19:20
|
||||
|
|
||||
LL | println!("{}", 1/(1-1));
|
||||
| ^^^^^^^ attempt to divide with overflow
|
||||
| ^^^^^^^ attempt to divide by zero
|
||||
|
||||
warning: attempt to divide by zero
|
||||
--> $DIR/promoted_errors.rs:22:14
|
||||
|
|
@ -40,11 +40,11 @@ warning: constant evaluation error
|
|||
--> $DIR/promoted_errors.rs:22:14
|
||||
|
|
||||
LL | let _x = 1/(1-1);
|
||||
| ^^^^^^^ attempt to divide with overflow
|
||||
| ^^^^^^^ attempt to divide by zero
|
||||
|
||||
warning: constant evaluation error
|
||||
--> $DIR/promoted_errors.rs:25:20
|
||||
|
|
||||
LL | println!("{}", 1/(false as u32));
|
||||
| ^^^^^^^^^^^^^^^^ attempt to divide with overflow
|
||||
| ^^^^^^^^^^^^^^^^ attempt to divide by zero
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ enum Enum {
|
|||
//~| const_err
|
||||
//~| const_err
|
||||
//~| const_err
|
||||
//~| divide by zero
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ warning: constant evaluation error
|
|||
--> $DIR/E0080.rs:14:9
|
||||
|
|
||||
LL | Y = (1 / 0) //~ ERROR E0080
|
||||
| ^^^^^^^ attempt to divide with overflow
|
||||
| ^^^^^^^ attempt to divide by zero
|
||||
|
||||
error[E0080]: constant evaluation error
|
||||
--> $DIR/E0080.rs:14:9
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue