repr-type specific oflo checks for enum discrim values.#23841
repr-type specific oflo checks for enum discrim values.#23841pnkfelix wants to merge 3 commits intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
|
(it would be nice to get this in for the beta release.) |
src/librustc/middle/ty.rs
Outdated
There was a problem hiding this comment.
Conventionally I believe our error messages start with lowercase letters, and I also think that two clauses are separated by semicolons (minor though)
There was a problem hiding this comment.
Okay, the capitalization and exclamation point were both inherited from the previous checking, but I'm happy to revise.
There was a problem hiding this comment.
Ah it's not super important in that case, we could just tweak the error message later if that's easier.
|
Looks good to me, thanks @pnkfelix! r=me with just a few nits. |
995b0fa to
cb8957e
Compare
|
@bors r=alexcrichton |
|
📌 Commit cb8957e has been approved by |
|
@bors r- (Rebase was unfinished) |
|
@bors r=alexcrichton |
|
📌 Commit 3800bb0 has been approved by |
|
⌛ Testing commit 3800bb0 with merge 2a65f72... |
|
💔 Test failed - auto-linux-64-x-android-t |
|
Okay, this reproduces locally (all one needs to do is cross-compile from a 64-bit host to a 32-bit target). |
|
📌 Commit 3ced9d1 has been approved by |
|
(does not fix #20600. :( more to do clearly.) |
|
☔ The latest upstream changes (presumably #23549) made this pull request unmergeable. Please resolve the merge conflicts. |
3ced9d1 to
18e4e30
Compare
…values. Moved such overflow checking into one place (in `rustc::middle::ty`, since it needs to be run on-demand during `const_eval` in some scenarios), and revised `rustc_typeck` accordingly. (Note that we only check for overflow if program did not provide a discriminant value explicitly.) Fix rust-lang#23030 Fix rust-lang#23221 Fix rust-lang#23235
…tch to target type.
18e4e30 to
278227e
Compare
|
@bors r=alexcrichton |
|
📌 Commit 278227e has been approved by |
|
@bors r- (seems like my rebase was not complete) |
|
closing in favor of #23863 |
const_eval : add overflow-checking for {`+`, `-`, `*`, `/`, `<<`, `>>`}.
One tricky detail here: There is some duplication of labor between `rustc::middle::const_eval` and `rustc_trans::trans::consts`. It might be good to explore ways to try to factor out the common structure to the two passes (by abstracting over the particular value-representation used in the compile-time interpreter).
----
Update: Rebased atop rust-lang#23841
Fix rust-lang#22531
Fix rust-lang#23030
Fix rust-lang#23221
Fix rust-lang#23235
repr-type specific oflo checks for enum discrim values.
Moved such overflow checking into one place (in
rustc::middle::ty, since it needs to be run on-demand duringconst_evalin some scenarios), and revisedrustc_typeckaccordingly.Fix #23030
Fix #23221
Fix #23235