Consider captures to be used by closures that unwind#152103
Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom Feb 16, 2026
Merged
Consider captures to be used by closures that unwind#152103rust-bors[bot] merged 1 commit intorust-lang:mainfrom
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
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).
Collaborator
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
58292e2 to
be5d5f2
Compare
Collaborator
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
be5d5f2 to
58292e2
Compare
Contributor
Author
|
Sorry, was on the wrong branch!! |
Contributor
|
r=me either way |
Contributor
Author
|
Can it? https://doc.rust-lang.org/nightly/reference/inline-assembly.html#r-asm.rules.unwind :
|
Member
|
r? cjgillot |
Contributor
|
@bors r+ rollup |
Contributor
jhpratt
added a commit
to jhpratt/rust
that referenced
this pull request
Feb 16, 2026
…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
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`)
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`)
rust-bors bot
pushed a commit
that referenced
this pull request
Feb 16, 2026
Rollup of 6 pull requests Successful merges: - #148206 (Deduplicated float tests and unified in floats/mod.rs) - #150601 (support c-variadic functions in `rustc_const_eval`) - #152103 (Consider captures to be used by closures that unwind) - #152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser) - #152648 (Remove timing assertion from `oneshot::send_before_recv_timeout`) - #152686 (bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked`) Failed merges: - #152512 (core: Implement feature `float_exact_integer_constants`)
rust-timer
added a commit
that referenced
this pull request
Feb 16, 2026
Rollup merge of #152103 - eggyal:caught-divergence-not-unused, 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 #152079 r? compiler
Contributor
Author
|
Nominating for beta backport since this fixes a regression in 1.92. @rustbot label beta-nominated |
github-actions bot
pushed a commit
to rust-lang/miri
that referenced
this pull request
Feb 17, 2026
Rollup of 6 pull requests Successful merges: - rust-lang/rust#148206 (Deduplicated float tests and unified in floats/mod.rs) - rust-lang/rust#150601 (support c-variadic functions in `rustc_const_eval`) - rust-lang/rust#152103 (Consider captures to be used by closures that unwind) - rust-lang/rust#152296 (Port `rust_nonnull_optimization_guaranteed` and `rustc_do_not_const_check` to the new attribute parser) - rust-lang/rust#152648 (Remove timing assertion from `oneshot::send_before_recv_timeout`) - rust-lang/rust#152686 (bootstrap: Inline the `is_tool` check for setting `-Zforce-unstable-if-unmarked`) Failed merges: - rust-lang/rust#152512 (core: Implement feature `float_exact_integer_constants`)
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.
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 #152079
r? compiler