-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Make liveness more precise for assignments to fields #73774
Conversation
Previously, we were too conservative and `x.field = 4` was treated as a "use" of `x`.
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦
r? @oli-obk |
@bors r+ |
📌 Commit ffcfaa1 has been approved by |
…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
Previously, we were too conservative and
x.field = 4
was treated as a "use" ofx
. Now it neither killsx
(since other fields ofx
may still be live) nor marks it as live.cc @jonas-schievink, who ran into this problem.