Skip to content

Commit f36a5b9

Browse files
committed
Auto merge of #120845 - petrochenkov:debmac, r=oli-obk
debuginfo: Stabilize `-Z debug-macros`, `-Z collapse-macro-debuginfo` and `#[collapse_debuginfo]` `-Z debug-macros` is "stabilized" by enabling it by default and removing. `-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`. It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no. Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local) - rust-lang/rust#100758 (comment) describes some debugging scenarios that motivate this default as reasonable. `#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default. Stabilization report: rust-lang/rust#120845 (comment) Closes rust-lang/rust#100758 Closes rust-lang/rust#41743 Closes rust-lang/rust#39153
2 parents 664e7fa + b57428c commit f36a5b9

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/shims/backtrace.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::*;
22
use rustc_ast::ast::Mutability;
33
use rustc_middle::ty::layout::LayoutOf as _;
44
use rustc_middle::ty::{self, Instance, Ty};
5-
use rustc_span::{BytePos, Loc, Symbol};
5+
use rustc_span::{hygiene, BytePos, Loc, Symbol};
66
use rustc_target::{abi::Size, spec::abi::Abi};
77

88
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {}
@@ -45,12 +45,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
4545

4646
let mut data = Vec::new();
4747
for frame in this.active_thread_stack().iter().rev() {
48-
let mut span = frame.current_span();
49-
// Match the behavior of runtime backtrace spans
50-
// by using a non-macro span in our backtrace. See `FunctionCx::debug_loc`.
51-
if span.from_expansion() && !tcx.sess.opts.unstable_opts.debug_macros {
52-
span = rustc_span::hygiene::walk_chain(span, frame.body.span.ctxt())
53-
}
48+
// Match behavior of debuginfo (`FunctionCx::adjusted_span_and_dbg_scope`).
49+
let span = hygiene::walk_chain_collapsed(frame.current_span(), frame.body.span);
5450
data.push((frame.instance, span.lo()));
5551
}
5652

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$DIR/backtrace-api-v0.rs:24:14 (func_d)
2-
$DIR/backtrace-api-v0.rs:20:5 (func_c)
2+
$DIR/backtrace-api-v0.rs:14:9 (func_c)
33
$DIR/backtrace-api-v0.rs:9:5 (func_b::<u8>)
44
$DIR/backtrace-api-v0.rs:5:5 (func_a)
55
$DIR/backtrace-api-v0.rs:29:18 (main)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
$DIR/backtrace-api-v1.rs:27:9 (func_d)
2-
$DIR/backtrace-api-v1.rs:20:5 (func_c)
2+
$DIR/backtrace-api-v1.rs:14:9 (func_c)
33
$DIR/backtrace-api-v1.rs:9:5 (func_b::<u8>)
44
$DIR/backtrace-api-v1.rs:5:5 (func_a)
55
$DIR/backtrace-api-v1.rs:34:18 (main)

0 commit comments

Comments
 (0)