Closed
Description
inlined inside a println!()
, I get a warning:
fn main() {
println!("{}", 1/false as u8);
}
error[E0080]: constant evaluation error
--> src/main.rs:4:17
|
4 | println!("{}", 1/false as u8);
| ^^^^^^^^^^^^^ attempted to do overflowing math
error: aborting due to previous error
however, when I involve a variable
fn main() {
let x = 1 / false as u8;
println!("{}", x);
}
there is no warning at all but looking at the generated code it is quite clear that this panics:
https://godbolt.org/g/NQmSFM