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
{{ message }}
Repository navigation
constant evaluation should not mask overflow for cases that are otherwise checked #22531
While working on rebasing #20795 I discovered that the new run-fail tests it adds were failing to panic, because the arithmetic in question was being handled by the constant evaluation, and the overflow was thus happening at compile time rather than run time.
An example of such an expression:
fnmain(){let x = 200u8 + 200u8 + 200u8;}
(Thank goodness it didn't cause my rustc to panic! That would have been a bit frustrating.)
That is, the program above should fail to compile, and it should not cause an ICE; it should signal a proper error message saying that the arithmetic expression overflowed (because 200+200+200 == 600 > 255 == u8::MAX).
Activity
oli-obk commentedon Feb 19, 2015
cc #13768
pnkfelix commentedon Feb 28, 2015
nominating, P-backcompat-lang. Suggest 1.0 polish.
Though arguably that combination is oxymoronic, and we should instead classify as 1.0 beta.
pnkfelix commentedon Feb 28, 2015
I'm going to actually add the tag and milestone myself, in anticipation of @nrc's triage service...
pnkfelix commentedon Mar 31, 2015
cc #23897
rollup merge of rust-lang#23863: pnkfelix/arith-oflo-const-eval