Skip to content

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable#159608

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
dianqk:hoist-in-early-else
Jul 24, 2026
Merged

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable#159608
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
dianqk:hoist-in-early-else

Conversation

@dianqk

@dianqk dianqk commented Jul 20, 2026

Copy link
Copy Markdown
Member

Fixes #159591.

A place may contain a dereference that cannot be safely hoisted when the otherwise branch is reachable.

@rustbot

rustbot commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 20, 2026
@rustbot

rustbot commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler, mir, mir-opt
  • compiler, mir, mir-opt expanded to 74 candidates
  • Random selection from 18 candidates

@dianqk
dianqk force-pushed the hoist-in-early-else branch from 39dd171 to a22fed7 Compare July 20, 2026 15:05
@davidtwco

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a22fed7 has been approved by davidtwco

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Jul 23, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 23, 2026
…dtwco

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable

Fixes rust-lang#159591.

A place may contain a dereference that cannot be safely hoisted when the otherwise branch is reachable.
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 23, 2026
…dtwco

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable

Fixes rust-lang#159591.

A place may contain a dereference that cannot be safely hoisted when the otherwise branch is reachable.
rust-bors Bot pushed a commit that referenced this pull request Jul 23, 2026
Rollup of 18 pull requests

Successful merges:

 - #138618 (Support using const pointers in asm `const` operand)
 - #150161 (Remove 'static requirement on try_as_dyn)
 - #158362 (trait solver: account for universes from replace_bound_vars)
 - #159173 (Add allowed list check on EII implementations attributes)
 - #159466 (cmse: clear variant-dependent padding in `enum`s)
 - #159718 (Make `DocLinkResMap` an `FxIndexMap`)
 - #155795 (constify `vec![1, 2, 3]` macro)
 - #157776 (ci: Enable autodiff tests on x86_64 linux)
 - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs)
 - #159041 (Reorganize `tests/ui/issues` [22/N])
 - #159108 (Reorganize `tests/ui/issues` [23/N])
 - #159138 (doc: document wasm import symbol mangling)
 - #159531 (Reorganize `tests/ui/issues` [28/N])
 - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable)
 - #159612 (Reorganize `tests/ui/issues` [29/N])
 - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`)
 - #159759 (rustc-dev-guide subtree update)
 - #159761 (Remove outdated comment for resolve_vars_with_obligations)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 23, 2026
…dtwco

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable

Fixes rust-lang#159591.

A place may contain a dereference that cannot be safely hoisted when the otherwise branch is reachable.
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 23, 2026
…dtwco

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable

Fixes rust-lang#159591.

A place may contain a dereference that cannot be safely hoisted when the otherwise branch is reachable.
rust-bors Bot pushed a commit that referenced this pull request Jul 23, 2026
Rollup of 19 pull requests

Successful merges:

 - #150161 (Remove 'static requirement on try_as_dyn)
 - #158362 (trait solver: account for universes from replace_bound_vars)
 - #159173 (Add allowed list check on EII implementations attributes)
 - #159466 (cmse: clear variant-dependent padding in `enum`s)
 - #159718 (Make `DocLinkResMap` an `FxIndexMap`)
 - #155795 (constify `vec![1, 2, 3]` macro)
 - #157776 (ci: Enable autodiff tests on x86_64 linux)
 - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs)
 - #158766 (Promote riscv64-unknown-linux-musl to tier 2 with host tools)
 - #159041 (Reorganize `tests/ui/issues` [22/N])
 - #159108 (Reorganize `tests/ui/issues` [23/N])
 - #159138 (doc: document wasm import symbol mangling)
 - #159531 (Reorganize `tests/ui/issues` [28/N])
 - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable)
 - #159612 (Reorganize `tests/ui/issues` [29/N])
 - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`)
 - #159667 (Make some parser structured suggestions verbose and tweak their wording)
 - #159759 (rustc-dev-guide subtree update)
 - #159761 (Remove outdated comment for resolve_vars_with_obligations)
@jhpratt

jhpratt commented Jul 23, 2026

Copy link
Copy Markdown
Member

@bors try jobs=dist-powerpc64le-linux-gnu

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 23, 2026
early_otherwise: Don't hoist dereferences when the otherwise branch is reachable


try-job: dist-powerpc64le-linux-gnu
@rust-bors

rust-bors Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 72da6fc (72da6fc9a432f0d644569f739da93e7cde277bbd)
Base parent: 2d8fa67 (2d8fa67781953811835f7ae45f670afbb7f44285)

rust-bors Bot pushed a commit that referenced this pull request Jul 24, 2026
Rollup of 20 pull requests

Successful merges:

 - #150161 (Remove 'static requirement on try_as_dyn)
 - #159412 (Reorganize `tests/ui/issues` [26/N])
 - #159466 (cmse: clear variant-dependent padding in `enum`s)
 - #157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs)
 - #158479 (Reject static item as direct const generic arg)
 - #159041 (Reorganize `tests/ui/issues` [22/N])
 - #159108 (Reorganize `tests/ui/issues` [23/N])
 - #159138 (doc: document wasm import symbol mangling)
 - #159531 (Reorganize `tests/ui/issues` [28/N])
 - #159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable)
 - #159612 (Reorganize `tests/ui/issues` [29/N])
 - #159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`)
 - #159719 (tests: add UI test for `.swap()` suggestion)
 - #159737 (rustfmt fix: allow file not found errors for external mods annotated with `#[my_macro]`)
 - #159759 (rustc-dev-guide subtree update)
 - #159761 (Remove outdated comment for resolve_vars_with_obligations)
 - #159764 (use `minicore::simd::Simd` more)
 - #159773 (Remove outdated workaround for `P` type)
 - #159778 (use lowest edition the test accepts)
 - #159788 (Avoid ICEing in RPIT method chain suggestion)
@rust-bors
rust-bors Bot merged commit ace4ff7 into rust-lang:main Jul 24, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 24, 2026
rust-timer added a commit that referenced this pull request Jul 24, 2026
Rollup merge of #159608 - dianqk:hoist-in-early-else, r=davidtwco

early_otherwise: Don't hoist dereferences when the otherwise branch is reachable

Fixes #159591.

A place may contain a dereference that cannot be safely hoisted when the otherwise branch is reachable.
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jul 25, 2026
Rollup of 20 pull requests

Successful merges:

 - rust-lang/rust#150161 (Remove 'static requirement on try_as_dyn)
 - rust-lang/rust#159412 (Reorganize `tests/ui/issues` [26/N])
 - rust-lang/rust#159466 (cmse: clear variant-dependent padding in `enum`s)
 - rust-lang/rust#157905 (Update comments and add tests for `-Zrandomize-layout` for some guaranteed ZSTs)
 - rust-lang/rust#158479 (Reject static item as direct const generic arg)
 - rust-lang/rust#159041 (Reorganize `tests/ui/issues` [22/N])
 - rust-lang/rust#159108 (Reorganize `tests/ui/issues` [23/N])
 - rust-lang/rust#159138 (doc: document wasm import symbol mangling)
 - rust-lang/rust#159531 (Reorganize `tests/ui/issues` [28/N])
 - rust-lang/rust#159608 (early_otherwise: Don't hoist dereferences when the otherwise branch is reachable)
 - rust-lang/rust#159612 (Reorganize `tests/ui/issues` [29/N])
 - rust-lang/rust#159653 (run `tests/assembly-llvm/asm/aarch64-types.rs` for `aarch64_be`)
 - rust-lang/rust#159719 (tests: add UI test for `.swap()` suggestion)
 - rust-lang/rust#159737 (rustfmt fix: allow file not found errors for external mods annotated with `#[my_macro]`)
 - rust-lang/rust#159759 (rustc-dev-guide subtree update)
 - rust-lang/rust#159761 (Remove outdated comment for resolve_vars_with_obligations)
 - rust-lang/rust#159764 (use `minicore::simd::Simd` more)
 - rust-lang/rust#159773 (Remove outdated workaround for `P` type)
 - rust-lang/rust#159778 (use lowest edition the test accepts)
 - rust-lang/rust#159788 (Avoid ICEing in RPIT method chain suggestion)
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimization introduces a pointer dereference on unreachable path

4 participants