Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make liveness more precise for assignments to fields #73774

Merged
merged 3 commits into from Jun 28, 2020

Conversation

ecstatic-morse
Copy link
Contributor

Previously, we were too conservative and x.field = 4 was treated as a "use" of x. Now it neither kills x (since other fields of x may still be live) nor marks it as live.

cc @jonas-schievink, who ran into this problem.

Previously, we were too conservative and `x.field = 4` was treated as a
"use" of `x`.
@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 26, 2020
let mut x: (i32, i32) = (42, 0);

// Assignment to a projection does not cause `x` to become live
unsafe { rustc_peek(x); } //~ ERROR bit not set
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be after the assignment? Same with the read below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Liveness propagates backwards, not forwards.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤦

@oli-obk
Copy link
Contributor

oli-obk commented Jun 27, 2020

r? @oli-obk

@rust-highfive rust-highfive assigned oli-obk and unassigned eddyb Jun 27, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Jun 28, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Jun 28, 2020

📌 Commit ffcfaa1 has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 28, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 28, 2020
…arth

Rollup of 9 pull requests

Successful merges:

 - rust-lang#73577 (Add partition_point)
 - rust-lang#73757 (Const prop: erase all block-only locals at the end of every block)
 - rust-lang#73774 (Make liveness more precise for assignments to fields)
 - rust-lang#73795 (Add some `const_compare_raw_pointers`-related regression tests)
 - rust-lang#73800 (Forward Hash::write_iN to Hash::write_uN)
 - rust-lang#73813 (Rename two `Resolver` traits)
 - rust-lang#73817 (Rename clashing_extern_decl to clashing_extern_declarations.)
 - rust-lang#73826 (Fix docstring typo)
 - rust-lang#73833 (Remove GlobalCtxt::enter_local)

Failed merges:

r? @ghost
@bors bors merged commit 3f826a8 into rust-lang:master Jun 28, 2020
@ecstatic-morse ecstatic-morse deleted the liveness-of-projections branch October 6, 2020 01:42
@cuviper cuviper added this to the 1.46 milestone May 2, 2024
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.

None yet

6 participants