about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/debuginfo
diff options
context:
space:
mode:
authorAndrew Zhogin <andrew.zhogin@gmail.com>2023-11-29 12:49:48 +0700
committerAndrew Zhogin <andrew.zhogin@gmail.com>2024-01-08 17:47:18 +0700
commitf2dbebafad629316edf37f9fc6a91633d9d1a702 (patch)
tree80aff022090efbd758320277738cf73d6798a237 /compiler/rustc_codegen_cranelift/src/debuginfo
parentca9ff83f1be558d4ce0a9a49b3d4d25034e5bd1e (diff)
downloadrust-f2dbebafad629316edf37f9fc6a91633d9d1a702.tar.gz
rust-f2dbebafad629316edf37f9fc6a91633d9d1a702.zip
Improved support of collapse_debuginfo attribute for macros.
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs10
1 files changed, 1 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs b/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs
index 6230ca15d6e..d1b21d0a0b6 100644
--- a/compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs
+++ b/compiler/rustc_codegen_cranelift/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];