Keep inlined var_debug_info only when full debug info is used
This commit is contained in:
@@ -982,14 +982,16 @@ fn inline_call<'tcx, I: Inliner<'tcx>>(
|
|||||||
// Insert all of the (mapped) parts of the callee body into the caller.
|
// 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.local_decls.extend(callee_body.drain_vars_and_temps());
|
||||||
caller_body.source_scopes.append(&mut callee_body.source_scopes);
|
caller_body.source_scopes.append(&mut callee_body.source_scopes);
|
||||||
|
|
||||||
|
// only "full" debug promises any variable-level information
|
||||||
if tcx
|
if tcx
|
||||||
.sess
|
.sess
|
||||||
.opts
|
.opts
|
||||||
.unstable_opts
|
.unstable_opts
|
||||||
.inline_mir_preserve_debug
|
.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
|
// people working on rust can build with or without debuginfo while
|
||||||
// still getting consistent results from the mir-opt tests.
|
// still getting consistent results from the mir-opt tests.
|
||||||
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
|
caller_body.var_debug_info.append(&mut callee_body.var_debug_info);
|
||||||
|
|||||||
Reference in New Issue
Block a user