You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of rust-lang#99556 - davidtwco:collapse-debuginfo, r=wesleywiser
ssa: implement `#[collapse_debuginfo]`
cc rust-lang#39153rust-lang/compiler-team#386
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour.
When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed.
r? rust-lang/wg-debugging
Copy file name to clipboardExpand all lines: src/debuginfo/line_info.rs
+3-3Lines changed: 3 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -68,9 +68,9 @@ impl DebugContext {
68
68
) -> (Lrc<SourceFile>,u64,u64){
69
69
// Based on https://github.com/rust-lang/rust/blob/e369d87b015a84653343032833d65d0545fd3f26/src/librustc_codegen_ssa/mir/mod.rs#L116-L131
70
70
// In order to have a good line stepping behavior in debugger, we overwrite debug
71
-
// locations of macro expansions with that of the outermost expansion site
72
-
// (unless the crate is being compiled with `-Z debug-macros`).
73
-
let span = if!span.from_expansion() || tcx.sess.opts.unstable_opts.debug_macros{
71
+
// locations of macro expansions with that of the outermost expansion site (when the macro is
72
+
// annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
73
+
let span = iftcx.should_collapse_debuginfo(span){
74
74
span
75
75
}else{
76
76
// Walk up the macro expansion chain until we reach a non-expanded span.
0 commit comments