You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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.
fix various const eval errors
These were found after const_evaluating arbitrary expressions and linting if the const evaluator failed
fixesrust-lang#33275 (int -> float casts for negative ints)
fixesrust-lang#33291 (int -> char casts (new! wasn't allowed in constants until this PR))
r? @eddyb
cc @bluss@japaric
STR
The "evaluated" expression
-128 as f32
doesn't trigger the warning. But if you expand the definition ofi8::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
cc @oli-obk might be related to #33214
The text was updated successfully, but these errors were encountered: