Skip to content

compiler: Require mir_opt_level > 1 for SingleUseConsts MIR pass#151426

Closed
Enselic wants to merge 1 commit intorust-lang:mainfrom
Enselic:single-use-consts-mir-opt-level
Closed

compiler: Require mir_opt_level > 1 for SingleUseConsts MIR pass#151426
Enselic wants to merge 1 commit intorust-lang:mainfrom
Enselic:single-use-consts-mir-opt-level

Conversation

@Enselic
Copy link
Member

@Enselic Enselic commented Jan 20, 2026

The default MIR opt level is 1 for non-optimized builds:

.unwrap_or_else(|| if self.opts.optimize != OptLevel::No { 2 } else { 1 })

Require mir_opt_level > 1 for SingleUseConsts MIR pass to make tests/debuginfo/basic-stepping.rs work again which builds with debuginfo but without optimizations. That test regressed when a precursor to SingleUseConsts was enabled. Well, the test didn't exist back then (I added it in #144876), but if it had existed, it would have regressed. The pass was first called ConstDebugInfo before it was rebirthed as SingleUseConsts.

This takes us one step closer towards closing #33013.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

9 participants