about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2024-06-16 21:14:41 +0100
committerGitHub <noreply@github.com>2024-06-16 21:14:41 +0100
commit1af0e6e0c3b857f5513064db953dfbde107e8290 (patch)
tree42bbf86bb9a457ff8dc3b98dfe74dd6d516f35ea /compiler/rustc_codegen_llvm
parenta033dab05d819e9a4056967f3183340eed388784 (diff)
parentb89a0a7838dc95362235a17d6f3d2cb90f466728 (diff)
downloadrust-1af0e6e0c3b857f5513064db953dfbde107e8290.tar.gz
rust-1af0e6e0c3b857f5513064db953dfbde107e8290.zip
Rollup merge of #126365 - Dirbaio:collapse-debuginfo-statics, r=workingjubilee
Honor collapse_debuginfo for statics.

fixes #126363

<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.

This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using

    r​? <reviewer name>
-->
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index a543ccbde0e..8de4e0effad 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -36,7 +36,7 @@ use rustc_middle::ty::{
 };
 use rustc_session::config::{self, DebugInfo, Lto};
 use rustc_span::symbol::Symbol;
-use rustc_span::FileName;
+use rustc_span::{hygiene, FileName, DUMMY_SP};
 use rustc_span::{FileNameDisplayPreference, SourceFile};
 use rustc_symbol_mangling::typeid_for_trait_ref;
 use rustc_target::abi::{Align, Size};
@@ -1306,7 +1306,7 @@ pub fn build_global_var_di_node<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId, glo
     // We may want to remove the namespace scope if we're in an extern block (see
     // https://github.com/rust-lang/rust/pull/46457#issuecomment-351750952).
     let var_scope = get_namespace_for_item(cx, def_id);
-    let span = tcx.def_span(def_id);
+    let span = hygiene::walk_chain_collapsed(tcx.def_span(def_id), DUMMY_SP);
 
     let (file_metadata, line_number) = if !span.is_dummy() {
         let loc = cx.lookup_debug_loc(span.lo());