Skip to content

Conversation

ecstatic-morse
Copy link
Contributor

@ecstatic-morse ecstatic-morse commented Oct 4, 2021

This arose from a discussion on Zulip where a new contributor attempted to implement a dead-store elimination pass using this analysis. They ran into a nasty hack around SetDiscriminant, which lets us handle assignments of literals to enum-typed locals (e.g. x = Some(4)) correctly. This took me a while to figure out.

Document this oddity, so the next person will have an easier time, and add a test to enshrine the current behavior.

r? @tmiasko

Copy link
Contributor

@tmiasko tmiasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for documenting this!

@oli-obk
Copy link
Contributor

oli-obk commented Oct 5, 2021

@bors r=oli-obk,tmiasko rollup

@bors
Copy link
Collaborator

bors commented Oct 5, 2021

📌 Commit 9f9f7f6 has been approved by oli-obk,tmiasko

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 5, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 5, 2021
…um, r=oli-obk,tmiasko

Document behavior of  `MaybeLiveLocals` regarding enums and field-senstivity

This arose from a [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/MaybeLiveLocals.20and.20Discriminants) where a new contributor attempted to implement a dead-store elimination pass using this analysis. They ran into a nasty hack around `SetDiscriminant` the effect of which is to lets handle assignments of literals to enum-typed locals (e.g. `x = Some(4)`) correctly. This took me a while to figure out.

Document this oddity, so the next person will have an easier time, and add a test to enshrine the current behavior.

r? `@tmiasko`
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 5, 2021
…arth

Rollup of 10 pull requests

Successful merges:

 - rust-lang#88706 (Normalize associated type projections when checking return type of main)
 - rust-lang#88828 (Use `libc::sigaction()` instead of `sys::signal()` to prevent a deadlock)
 - rust-lang#88871 (Fix suggestion for nested struct patterns)
 - rust-lang#89317 (Move generic error message to separate branches)
 - rust-lang#89351 (for signed wrapping remainder, do not compare lhs with MIN)
 - rust-lang#89442 (Add check for duplicated doc aliases)
 - rust-lang#89502 (Fix Lower/UpperExp formatting for integers and precision zero)
 - rust-lang#89523 (Make `proc_macro_derive_resolution_fallback` a future-breakage lint)
 - rust-lang#89532 (Document behavior of  `MaybeLiveLocals` regarding enums and field-senstivity)
 - rust-lang#89546 (Make an initial guess for metadata size to reduce buffer resizes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f71b3e2 into rust-lang:master Oct 6, 2021
@rustbot rustbot added this to the 1.57.0 milestone Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants