Uh oh!
There was an error while loading. Please reload this page.
derive: assume enum repr defaults to isize - #32253
Conversation
alexcrichton
commented
Mar 14, 2016
@bors: r+ e45b59aed463c15bd9aadd8280f4a5d49027e73f |
bors
commented
Mar 14, 2016
☔ The latest upstream changes (presumably #30587) made this pull request unmergeable. Please resolve the merge conflicts. |
durka
commented
Mar 14, 2016
@oli-obk is this fix now irrelevant given your PR? |
oli-obk
commented
Mar 15, 2016
well kindof. I actually broke the following construct (explicitly, not accidentally) on 32bit enumEu64{Au64 = 0,Bu64 = 0x8000_0000_0000_0000}because on 32bit rustc now errors at compiletime about the collision Once we properly fix the automatic enum discriminant type detection, the issue might appear again. |
durka
commented
Mar 15, 2016
@oli-obk can you clarify what it means to properly fix discriminant detection, and what the current situation is? Is deriving correct in assuming that if the repr isn't specified than it will be isize (or smaller)? |
oli-obk
commented
Mar 15, 2016
In list form, because I'm confusing myself when I'm writing it in text form.
well... the discriminant should be |
durka
commented
Mar 17, 2016
oli-obk
commented
Mar 18, 2016
oh.... I only tested on 32 bit... it obviously only collides on 32 bit... So yea, this change is still necessary for 64 bit. |
It was originally intended to be i32, but it isn't. Fixesrust-lang#31886.
durka
commented
Mar 18, 2016
Okay, so I changed it back to Note that you can still write a program like this: enumEu64{Au64 = 0,Bu64 = 0x8000_0000_0000_0001//~WARN literal out of range for isize}fnmain(){println!("{} {} {}", std::mem::size_of::<Eu64>(),Eu64::Au64asisize,Eu64::Bu64asisize);}which prints different answers on 32- and 64-bit ( |
durka
commented
Mar 18, 2016
And combined with the fact that I guess that's the price you pay for ignoring the warnings. |
alexcrichton
commented
Mar 19, 2016
Sorry I've gotten a bit lost with all the changes in flight. Is this ready to go? Did something about constants change how we want to do this? |
durka
commented
Mar 21, 2016
@alexcrichton what I believe is that is no longer possible to trigger #31886 on a 32-bit system because @oli-obk's const evaluator will catch the collision. However, my fix (as implemented currently, in this PR!) is still needed to avoid #31886 on 64-bit systems. |
alexcrichton
commented
Mar 21, 2016
bors
commented
Mar 21, 2016
⌛ Testing commit 9d0748f with merge 2ddcf31... |
bors
commented
Mar 21, 2016
💔 Test failed - auto-win-msvc-64-opt-rustbuild |
oli-obk
commented
Mar 21, 2016
spurious failure
|
alexcrichton
commented
Mar 21, 2016
@bors: retry |
bors
commented
Mar 22, 2016
derive: assume enum repr defaults to isize derive: assume enum repr defaults to isize Fixes#31886. Spawned from #32139. r? @alexcrichton
derive: assume enum repr defaults to isize
Fixes#31886.
Spawned from #32139.
r? @alexcrichton