Closed
Description
STR
// cast.rs
use std::i8;
fn main() {
i8::MIN as f32;
}
$ rustc cast.rs
cast.rs:5:5: 5:19 warning: attempted to negate with overflow, #[warn(const_err)] on by default
cast.rs:5 i8::MIN as f32;
^~~~~~~~~~~~~~
The "evaluated" expression -128 as f32
doesn't trigger the warning. But if you expand the definition of i8::MIN
i.e. ((-1 as i8) << 8 - 1) as f32
you also get a warning.
Neither of these three equivalent expressions should trigger a warning.
Metadata
$ rustc -V
rustc 1.10.0-nightly (cda7c1cf2 2016-04-27)
Metadata
Metadata
Assignees
Labels
No labels