Reason about borrowed classes in CopyProp. by cjgillot · Pull Request #142571 · rust-lang/rust

@rustbot rustbot added the T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

label

Jun 16, 2025

oli-obk

oli-obk

@cjgillot

@cjgillot

@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 17, 2025

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jun 18, 2025
Reason about borrowed classes in CopyProp.

Fixes rust-lang#141122

The current implementation of `CopyProp` avoids unifying two borrowed locals, as this would change the result of address comparison.

However, the implementation was inconsistent with the general algorithm, which identifies equivalence classes of locals and then replaces all locals by a single representative of their equivalence class.

This PR fixes it by forbidding the unification of two *classes* if any of those contain a borrowed local.

bors added a commit that referenced this pull request

Jun 18, 2025
Rollup of 10 pull requests

Successful merges:

 - #135656 (Add `-Z hint-mostly-unused` to tell rustc that most of a crate will go unused)
 - #138237 (Get rid of `EscapeDebugInner`.)
 - #140772 ({aarch64,x86_64}-pc-windows-gnullvm: build host tools)
 - #140774 (Affirm `-Cforce-frame-pointers=off` does not override)
 - #141610 (Stabilize `feature(generic_arg_infer)`)
 - #141864 (Handle win32 separator for cygwin paths)
 - #142384 (Bringing `rustc_rayon_core` in tree as `rustc_thread_pool`)
 - #142502 (rustdoc_json: improve handling of generic args)
 - #142571 (Reason about borrowed classes in CopyProp.)
 - #142591 (Add spawn APIs for BootstrapCommand to support deferred command execution)

r? `@ghost`
`@rustbot` modify labels: rollup

jhpratt added a commit to jhpratt/rust that referenced this pull request

Jun 19, 2025
Reason about borrowed classes in CopyProp.

Fixes rust-lang#141122

The current implementation of `CopyProp` avoids unifying two borrowed locals, as this would change the result of address comparison.

However, the implementation was inconsistent with the general algorithm, which identifies equivalence classes of locals and then replaces all locals by a single representative of their equivalence class.

This PR fixes it by forbidding the unification of two *classes* if any of those contain a borrowed local.

bors added a commit that referenced this pull request

Jun 19, 2025
Rollup of 10 pull requests

Successful merges:

 - #138291 (rewrite `optimize` attribute to use new attribute parsing infrastructure)
 - #141990 (Implement send_signal for unix child processes)
 - #142331 (Add `trim_prefix` and `trim_suffix` methods for both `slice` and `str` types.)
 - #142478 (install docs for each target in different directory)
 - #142571 (Reason about borrowed classes in CopyProp.)
 - #142668 (vec_deque/fmt/vec tests: remove static mut)
 - #142687 (Reduce uses of `hir_crate`.)
 - #142690 (expand: Remove some unnecessary generic parameters)
 - #142699 (Update books)
 - #142714 (add comment to `src/bootstrap/build.rs`)

Failed merges:

 - #142502 (rustdoc_json: improve handling of generic args)

r? `@ghost`
`@rustbot` modify labels: rollup

bors added a commit that referenced this pull request

Jun 21, 2025
Rollup of 8 pull requests

Successful merges:

 - #142384 (Bringing `rustc_rayon_core` in tree as `rustc_thread_pool`)
 - #142476 (Insert parentheses around binary operation with attribute)
 - #142485 (Marks ADT live if it appears in pattern)
 - #142571 (Reason about borrowed classes in CopyProp.)
 - #142677 (Add CI check to ensure that rustdoc JSON `FORMAT_VERSION` is correctly updated)
 - #142716 (Adjust `with_generic_param_rib`.)
 - #142756 (Make `Clone` a `const_trait`)
 - #142765 (rustc_target: document public AbiMap-related fn and variants)

r? `@ghost`
`@rustbot` modify labels: rollup

rust-timer added a commit that referenced this pull request

Jun 21, 2025
Rollup merge of #142571 - cjgillot:borrowed-classes, r=oli-obk

Reason about borrowed classes in CopyProp.

Fixes #141122

The current implementation of `CopyProp` avoids unifying two borrowed locals, as this would change the result of address comparison.

However, the implementation was inconsistent with the general algorithm, which identifies equivalence classes of locals and then replaces all locals by a single representative of their equivalence class.

This PR fixes it by forbidding the unification of two *classes* if any of those contain a borrowed local.

@lqd lqd mentioned this pull request

Jul 5, 2025