diff options
| author | bors <bors@rust-lang.org> | 2025-07-03 23:17:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-07-03 23:17:03 +0000 |
| commit | 837c5dd7de03aa97190593aef4e70d53e1bb574b (patch) | |
| tree | 9fb488e2fbef28f8a4c938d88f0c53d4a91cf7fa /compiler | |
| parent | da58c051315268a197ce280f6ba07bbd03c66535 (diff) | |
| parent | c9ef11695ffee0dc17f795b51c19f333abdb08a2 (diff) | |
| download | rust-837c5dd7de03aa97190593aef4e70d53e1bb574b.tar.gz rust-837c5dd7de03aa97190593aef4e70d53e1bb574b.zip | |
Auto merge of #142890 - kornelski:unused-var-debug, r=saethlin
MIR inliner maintains unused var_debug_info Only `full` debuginfo level promises variable-level debug information, but the MIR inline pass needlessly preserved the local variable debug info for the `limited` level too.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 7852bb7ae2f..1c0fc774867 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -982,14 +982,16 @@ fn inline_call<'tcx, I: Inliner<'tcx>>( // Insert all of the (mapped) parts of the callee body into the caller. caller_body.local_decls.extend(callee_body.drain_vars_and_temps()); caller_body.source_scopes.append(&mut callee_body.source_scopes); + + // only "full" debug promises any variable-level information if tcx .sess .opts .unstable_opts .inline_mir_preserve_debug - .unwrap_or(tcx.sess.opts.debuginfo != DebugInfo::None) + .unwrap_or(tcx.sess.opts.debuginfo == DebugInfo::Full) { - // Note that we need to preserve these in the standard library so that + // -Zinline-mir-preserve-debug is enabled when building the standard library, so that // people working on rust can build with or without debuginfo while // still getting consistent results from the mir-opt tests. caller_body.var_debug_info.append(&mut callee_body.var_debug_info); |
