Skip to content

Const analysis cleanups - #163529

Merged
rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
nnethercote:ConstAnalysis
Oct 5, 2026
Merged

rust-bors[bot] merged 8 commits into
rust-lang:mainfrom
nnethercote:ConstAnalysis

Conversation

@nnethercote

Copy link
Copy Markdown
Contributor

Details in individual commits.

r? @saethlin

It has a single call site, where it can be replaced with
`insert_value_idx` because `flood_discr` and `find_discr` are already
done.
It's basically the same as `Option::and_then`.
`handle_assign` handles several `Rvalue` variants, and then falls
through to the only call site of `handle_rvalue`, which handles all the
`Rvalue` variants. The `Use`, `CopyForDeref`, and `Aggregate` arms in
`handle_rvalue` are unreachable because those variants are fully handled
by `handle_assign`

This commit just inlines and removes `handle_rvalue`, which makes the
control flow simpler and avoids the unreachable arms.
These all have a single call site and are tiny or small, and several are
called from methods that are also tiny. (Too many small methods just
spreads things out unnecessarily.) The only remaining `handle_*` methods
are `handle_assign`, which is large, and `handle_operand`, which has
multiple call sites.
@rustbot

rustbot commented Sep 30, 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 Sep 30, 2026
@nnethercote

Copy link
Copy Markdown
Contributor Author

LLM disclosure: some of these changes were identified by an LLM. I made all the code and text changes myself.

@saethlin

saethlin commented Oct 5, 2026

Copy link
Copy Markdown
Member

Neat. Thanks for doing things like this, especially trimming down mutability and visibility.

@bors r+

@rust-bors

rust-bors Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 491b4c8 has been approved by saethlin

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 Oct 5, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 5, 2026
Rollup of 3 pull requests

Successful merges:

 - #153160 (Fix relative extern URL depth on source pages)
 - #163529 (Const analysis cleanups)
 - #163567 (Use a loop to avoid emitting long sequences of retags.)
@rust-bors
rust-bors Bot merged commit 0bd8384 into rust-lang:main Oct 5, 2026
13 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 5, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 5, 2026
Rollup merge of #163529 - nnethercote:ConstAnalysis, r=saethlin

Const analysis cleanups

Details in individual commits.

r? @saethlin
@nnethercote
nnethercote deleted the ConstAnalysis branch October 6, 2026 04:44
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.

3 participants