Allow variant discriminant initializers to refer to other initializer…#50072
Allow variant discriminant initializers to refer to other initializer…#50072bors merged 1 commit intorust-lang:masterfrom
Conversation
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
src/librustc/ty/mod.rs
Outdated
There was a problem hiding this comment.
Looks like this was cut off (missing "and"?).
src/librustc_mir/hair/cx/expr.rs
Outdated
There was a problem hiding this comment.
Self-reminder that this check should always apply (i.e. be higher up than the variant check) because of things like Enum::Variant as Enum.
|
So this basically narrowly allows referring to other variants, as long as you cast it to an int? |
|
Yes. This is what was happening before, too. |
9c9793a to
3e35d77
Compare
|
@eddyb done |
|
Ping @eddyb |
src/librustc_mir/hair/cx/expr.rs
Outdated
There was a problem hiding this comment.
s/probably isize and thus doesn't need to know/always an integer and (hopefully) doesn't need to know
src/librustc_mir/hair/cx/expr.rs
Outdated
There was a problem hiding this comment.
the source binding is of different type
There was a problem hiding this comment.
What about the result of calling .to_ref()?
src/librustc_mir/hair/cx/expr.rs
Outdated
There was a problem hiding this comment.
Can this mk_const be deduplicated between the two match arms?
src/librustc_mir/hair/cx/expr.rs
Outdated
There was a problem hiding this comment.
Does this need to take tcx? It should have cx in scope - worst case, you do a let tcx = cx.tcx(); before the closure.
src/librustc_mir/hair/cx/expr.rs
Outdated
There was a problem hiding this comment.
Hmm, if I think more about this, mk_const should also call .to_ref(), to reduce the number of calls further (and to avoid having an inner source variable too.
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@bors r+ p=5 |
|
📌 Commit 33f9c7e has been approved by |
|
⌛ Testing commit 33f9c7e6fe684883c0e54149245d7fc189940768 with merge dc769e14f23510fff06476b4a31bc9b27ec4e4fb... |
|
Oops, I was hoping @oli-obk would get to fix it in time and didn't cancel my r+ 😞. |
|
💔 Test failed - status-travis |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
…s of the same enum
|
@bors r=eddyb p=5 sorry about that. Yesterday I had no PC available to me to actually check stuff. |
|
📌 Commit 195c9f4 has been approved by |
|
☀️ Test successful - status-appveyor, status-travis |
…s of the same enum
r? @eddyb
fixes the 2.4 failure of #49765
cc @durka @retep998