Skip to content

Commit c9ef116

Browse files
committed
Keep inlined var_debug_info only when full debug info is used
1 parent db9daab commit c9ef116

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/rustc_mir_transform/src/inline.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -982,14 +982,16 @@ fn inline_call<'tcx, I: Inliner<'tcx>>(
982982
// Insert all of the (mapped) parts of the callee body into the caller.
983983
caller_body.local_decls.extend(callee_body.drain_vars_and_temps());
984984
caller_body.source_scopes.append(&mut callee_body.source_scopes);
985+
986+
// only "full" debug promises any variable-level information
985987
if tcx
986988
.sess
987989
.opts
988990
.unstable_opts
989991
.inline_mir_preserve_debug
990-
.unwrap_or(tcx.sess.opts.debuginfo != DebugInfo::None)
992+
.unwrap_or(tcx.sess.opts.debuginfo == DebugInfo::Full)
991993
{
992-
// Note that we need to preserve these in the standard library so that
994+
// -Zinline-mir-preserve-debug is enabled when building the standard library, so that
993995
// people working on rust can build with or without debuginfo while
994996
// still getting consistent results from the mir-opt tests.
995997
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);

0 commit comments

Comments
 (0)