Open
Conversation
Assignments to a captured variable within a diverging closure should not be considered unused if the divergence is caught. This patch considers such assignments/captures to be used by diverging closures irrespective of whether the divergence is caught, but better a false negative unused lint than a false positive one (the latter having caused a stable-to-stable regression).
…d, r=cjgillot Consider captures to be used by closures that unwind Assignments to a captured variable within a diverging closure should not be considered unused if the divergence is caught. This patch considers such assignments/captures to be used by diverging closures irrespective of whether the divergence is caught, but better a false negative unused lint than a false positive one (the latter having caused a stable-to-stable regression). Fixes rust-lang#152079 r? compiler
…thlin Implement opt-bisect-limit for MIR closes: rust-lang#150910 Enable bisecting MIR optimization passes to enhance debuggability. discussions on zulip: https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/MIR.20dump.20the.20pass.20names/with/573219207 ### Check it works #### Sample code ```rust fn abs(num: isize) -> usize { if num < 0 { -num as usize } else { num as usize } } fn main() { println!("{}", abs(-10)); } ``` #### Output ```shell rustc +mir -Zmir-opt-bisect-limit=30 src/main.rs BISECT: running pass (1) CheckAlignment on main[89d5]::main BISECT: running pass (2) CheckNull on main[89d5]::main BISECT: running pass (3) CheckEnums on main[89d5]::main BISECT: running pass (4) LowerSliceLenCalls on main[89d5]::main BISECT: running pass (5) InstSimplify-before-inline on main[89d5]::main BISECT: running pass (6) ForceInline on main[89d5]::main BISECT: running pass (7) RemoveStorageMarkers on main[89d5]::main BISECT: running pass (8) RemoveZsts on main[89d5]::main BISECT: running pass (9) RemoveUnneededDrops on main[89d5]::main BISECT: running pass (10) UnreachableEnumBranching on main[89d5]::main BISECT: running pass (11) SimplifyCfg-after-unreachable-enum-branching on main[89d5]::main BISECT: running pass (12) InstSimplify-after-simplifycfg on main[89d5]::main BISECT: running pass (13) SimplifyConstCondition-after-inst-simplify on main[89d5]::main BISECT: running pass (14) SimplifyLocals-before-const-prop on main[89d5]::main BISECT: running pass (15) SimplifyLocals-after-value-numbering on main[89d5]::main BISECT: running pass (16) MatchBranchSimplification on main[89d5]::main BISECT: running pass (17) SingleUseConsts on main[89d5]::main BISECT: running pass (18) SimplifyConstCondition-after-const-prop on main[89d5]::main BISECT: running pass (19) SimplifyConstCondition-final on main[89d5]::main BISECT: running pass (20) RemoveNoopLandingPads on main[89d5]::main BISECT: running pass (21) SimplifyCfg-final on main[89d5]::main BISECT: running pass (22) CopyProp on main[89d5]::main BISECT: running pass (23) SimplifyLocals-final on main[89d5]::main BISECT: running pass (24) AddCallGuards on main[89d5]::main BISECT: running pass (25) PreCodegen on main[89d5]::main BISECT: running pass (26) CheckAlignment on main[89d5]::abs BISECT: running pass (27) CheckNull on main[89d5]::abs BISECT: running pass (28) CheckEnums on main[89d5]::abs BISECT: running pass (29) LowerSliceLenCalls on main[89d5]::abs BISECT: running pass (30) InstSimplify-before-inline on main[89d5]::abs BISECT: NOT running pass (31) ForceInline on main[89d5]::abs BISECT: NOT running pass (32) RemoveStorageMarkers on main[89d5]::abs BISECT: NOT running pass (33) RemoveZsts on main[89d5]::abs BISECT: NOT running pass (34) RemoveUnneededDrops on main[89d5]::abs BISECT: NOT running pass (35) UnreachableEnumBranching on main[89d5]::abs BISECT: NOT running pass (36) SimplifyCfg-after-unreachable-enum-branching on main[89d5]::abs BISECT: NOT running pass (37) InstSimplify-after-simplifycfg on main[89d5]::abs BISECT: NOT running pass (38) SimplifyConstCondition-after-inst-simplify on main[89d5]::abs BISECT: NOT running pass (39) SimplifyLocals-before-const-prop on main[89d5]::abs BISECT: NOT running pass (40) SimplifyLocals-after-value-numbering on main[89d5]::abs BISECT: NOT running pass (41) MatchBranchSimplification on main[89d5]::abs BISECT: NOT running pass (42) SingleUseConsts on main[89d5]::abs BISECT: NOT running pass (43) SimplifyConstCondition-after-const-prop on main[89d5]::abs BISECT: NOT running pass (44) SimplifyConstCondition-final on main[89d5]::abs BISECT: NOT running pass (45) RemoveNoopLandingPads on main[89d5]::abs BISECT: NOT running pass (46) SimplifyCfg-final on main[89d5]::abs BISECT: NOT running pass (47) CopyProp on main[89d5]::abs BISECT: NOT running pass (48) SimplifyLocals-final on main[89d5]::abs BISECT: NOT running pass (49) AddCallGuards on main[89d5]::abs BISECT: NOT running pass (50) PreCodegen on main[89d5]::abs ``` r? @saethlin
…jhpratt Remove timing assertion from `oneshot::send_before_recv_timeout` This test regularly spuriously fails in CI, such as rust-lang#152632 (comment) We can just remove the assertion but I'd like to understand why, so I'm adding more information to the assert
bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked` `Mode::is_tool` is the sort of method that looks general-purpose, but is only actually used for a very specific purpose, to control the setting of `-Zforce-unstable-if-unmarked`. It is therefore clearer to inline the mode check, which makes it easier to see how the condition affects the result. I have tried to add some comments explaining why we set that flag, but they are based on my own recent investigations, so I'm not 100% confident that they're accurate.
Member
Author
|
@bors r+ rollup=never p=5 |
Contributor
Contributor
|
⌛ Testing commit 86fdd65 with merge 3125d5c... Workflow: https://github.com/rust-lang/rust/actions/runs/22049846572 |
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 16, 2026
Rollup of 4 pull requests Successful merges: - #152103 (Consider captures to be used by closures that unwind) - #152474 (Implement opt-bisect-limit for MIR) - #152648 (Remove timing assertion from `oneshot::send_before_recv_timeout`) - #152686 (bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked`)
Member
|
Member
Author
|
@bors yield |
Contributor
|
Auto build cancelled. Cancelled workflows: The next pull request likely to be tested is #152636. |
Member
Author
|
@bors r+ |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
oneshot::send_before_recv_timeout#152648 (Remove timing assertion fromoneshot::send_before_recv_timeout)is_toolcheck for setting-Zforce-unstable-if-unmarked#152686 (bootstrap: Inline theis_toolcheck for setting-Zforce-unstable-if-unmarked)r? @ghost
Create a similar rollup