about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKornel <kornel@geekhood.net>2025-02-08 01:33:38 +0000
committerKornel <kornel@geekhood.net>2025-06-28 12:22:49 +0100
commitc9ef11695ffee0dc17f795b51c19f333abdb08a2 (patch)
tree35a6d771691e85d44c6887f49efbf51450e721ad
parentdb9daab1ee4146b634492a86391914f3ab6002b7 (diff)
downloadrust-c9ef11695ffee0dc17f795b51c19f333abdb08a2.tar.gz
rust-c9ef11695ffee0dc17f795b51c19f333abdb08a2.zip
Keep inlined var_debug_info only when full debug info is used
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs6
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 f48dba9663a..d86daf937da 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);