fix[154166]: closure debug capture print - #162154
Merged
rust-bors[bot] merged 1 commit intoSep 4, 2026
Merged
Conversation
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project has assigned @folkertdev (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
|
r? types |
Member
|
I think this is correct but can you share the before and after MIR of #154166 |
Contributor
Author
Compiled using rustc \
tests/mir-opt/issues/issue_154166.rs \
--edition=2021 \
-Zunpretty=mirafter MIR $ cat mir_dump/issue-162074.mir.after
// WARNING: This output format is intended for human consumers only
// and is subject to change without notice. Knock yourself out.
// HINT: See also -Z dump-mir for MIR at specific points during compilation.
fn foo(_1: (String, String)) -> () {
debug x => _1;
let mut _0: ();
let _2: {closure@tests/mir-opt/issues/issue_154166.rs:13:20: 13:22};
let mut _3: &std::string::String;
scope 1 {
debug _closure => _2;
}
bb0: {
_3 = &(_1.1: std::string::String);
_2 = {closure@tests/mir-opt/issues/issue_154166.rs:13:20: 13:22} { x__0: move (_1.0: std::string::String), x__1: move _3 };
drop(_2) -> [return: bb1, unwind: bb4];
}
bb1: {
drop((_1.1: std::string::String)) -> [return: bb2, unwind continue];
}
bb2: {
return;
}
bb3 (cleanup): {
resume;
}
bb4 (cleanup): {
drop((_1.1: std::string::String)) -> [return: bb3, unwind terminate(cleanup)];
}
}
fn foo::{closure#0}(_1: {closure@tests/mir-opt/issues/issue_154166.rs:13:20: 13:22}) -> () {
debug x__0 => (_1.0: std::string::String);
debug x__1 => (*(_1.1: &std::string::String));
let mut _0: ();
let mut _2: bool;
let _3: std::string::String;
let mut _4: &std::string::String;
let mut _5: bool;
scope 1 {
debug _a => _4;
}
scope 2 {
debug _b => _3;
}
bb0: {
_5 = const false;
_5 = const true;
_2 = std::hint::black_box::<bool>(const true) -> [return: bb1, unwind: bb9];
}
bb1: {
switchInt(move _2) -> [0: bb3, otherwise: bb2];
}
bb2: {
_4 = no_retag copy (_1.1: &std::string::String);
goto -> bb4;
}
bb3: {
_5 = const false;
_3 = move (_1.0: std::string::String);
drop(_3) -> [return: bb4, unwind: bb9];
}
bb4: {
switchInt(copy _5) -> [0: bb5, otherwise: bb7];
}
bb5: {
return;
}
bb6 (cleanup): {
resume;
}
bb7: {
drop((_1.0: std::string::String)) -> [return: bb5, unwind continue];
}
bb8 (cleanup): {
drop((_1.0: std::string::String)) -> [return: bb6, unwind terminate(cleanup)];
}
bb9 (cleanup): {
switchInt(copy _5) -> [0: bb6, otherwise: bb8];
}
} |
Member
|
@bors r+ |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 3, 2026
…closure-debug, r=spastorino fix[154166]: closure debug capture print Found and remove the `// FIXME(project-rfc-2229#48)` [see](rust-lang/rfcs#2229) in `mir/pretty.rs` used to Debug print mir. Fix was to replace the old `tcx.upvars_mentioned` with `tcx.closure_captures`. Added a test to check for printing of both in 2018 and 2021
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 3, 2026
…closure-debug, r=spastorino fix[154166]: closure debug capture print Found and remove the `// FIXME(project-rfc-2229#48)` [see](rust-lang/rfcs#2229) in `mir/pretty.rs` used to Debug print mir. Fix was to replace the old `tcx.upvars_mentioned` with `tcx.closure_captures`. Added a test to check for printing of both in 2018 and 2021
This was referenced Sep 3, 2026
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 3, 2026
…uwer Rollup of 12 pull requests Successful merges: - #161227 (implement `Add` and `Sub` for `Complex`) - #161280 (make target feature ABI check a hard error on ARM) - #161893 (Add custom allocator support to `(try_)map` on `UniqueArc` and `UniqueRc`) - #162154 (fix[154166]: closure debug capture print) - #161951 (Windows: add fallback if `canonicalize` fails) - #162173 (fix supposedly unreachable `bug!` being reachable) - #162180 (remove outdated next-solver handling) - #162191 (core: mark float `ClampBounds` methods as `#[inline]`) - #162195 (docs(time): clarify exact seconds for week and day) - #162199 (docs(time): clarify exact seconds for hour and minute) - #162222 (coverage: Small cleanups in `extract_hir_info`) - #162230 (Pass -Z merge-functions=disabled in tests/codegen-llvm/intrinsics/unchecked_math.rs)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 4, 2026
…uwer Rollup of 12 pull requests Successful merges: - #161227 (implement `Add` and `Sub` for `Complex`) - #161280 (make target feature ABI check a hard error on ARM) - #161893 (Add custom allocator support to `(try_)map` on `UniqueArc` and `UniqueRc`) - #162154 (fix[154166]: closure debug capture print) - #161951 (Windows: add fallback if `canonicalize` fails) - #162173 (fix supposedly unreachable `bug!` being reachable) - #162180 (remove outdated next-solver handling) - #162191 (core: mark float `ClampBounds` methods as `#[inline]`) - #162195 (docs(time): clarify exact seconds for week and day) - #162199 (docs(time): clarify exact seconds for hour and minute) - #162222 (coverage: Small cleanups in `extract_hir_info`) - #162230 (Pass -Z merge-functions=disabled in tests/codegen-llvm/intrinsics/unchecked_math.rs)
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 4, 2026
Rollup merge of #162154 - joseph-isaacs:ji/issue-154166-mir-closure-debug, r=spastorino fix[154166]: closure debug capture print Found and remove the `// FIXME(project-rfc-2229#48)` [see](rust-lang/rfcs#2229) in `mir/pretty.rs` used to Debug print mir. Fix was to replace the old `tcx.upvars_mentioned` with `tcx.closure_captures`. Added a test to check for printing of both in 2018 and 2021
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.
Found and remove the
// FIXME(project-rfc-2229#48)see inmir/pretty.rsused to Debug print mir.Fix was to replace the old
tcx.upvars_mentionedwithtcx.closure_captures.Added a test to check for printing of both in 2018 and 2021