about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-01-09 00:19:32 +0100
committerGitHub <noreply@github.com>2024-01-09 00:19:32 +0100
commita2a9032d1b04041f01ba9331b79aef36c8b8a33e (patch)
tree35a9b7fdae689ad62ccb6167486c94f91555eac0 /src
parente6570dccccd85f5bfc8497bbd4db615f1d2fdbd2 (diff)
parent2b3cd46832d99218576b5d01c910a64a4330b542 (diff)
downloadrust-a2a9032d1b04041f01ba9331b79aef36c8b8a33e.tar.gz
rust-a2a9032d1b04041f01ba9331b79aef36c8b8a33e.zip
Rollup merge of #118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, r=petrochenkov
Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc https://github.com/rust-lang/rust/issues/100758
Diffstat (limited to 'src')
-rw-r--r--src/debuginfo/line_info.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs
index 6230ca15d6e..d1b21d0a0b6 100644
--- a/src/debuginfo/line_info.rs
+++ b/src/debuginfo/line_info.rs
@@ -68,15 +68,7 @@ impl DebugContext {
         // In order to have a good line stepping behavior in debugger, we overwrite debug
         // locations of macro expansions with that of the outermost expansion site (when the macro is
         // annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
-        let span = if tcx.should_collapse_debuginfo(span) {
-            span
-        } else {
-            // Walk up the macro expansion chain until we reach a non-expanded span.
-            // We also stop at the function body level because no line stepping can occur
-            // at the level above that.
-            rustc_span::hygiene::walk_chain(span, function_span.ctxt())
-        };
-
+        let span = tcx.collapsed_debuginfo(span, function_span);
         match tcx.sess.source_map().lookup_line(span.lo()) {
             Ok(SourceFileAndLine { sf: file, line }) => {
                 let line_pos = file.lines()[line];