about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/debuginfo
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-10 23:10:59 +0000
committerbors <bors@rust-lang.org>2022-03-10 23:10:59 +0000
commit352e621368c31d7b4a6362e081586cdb931ba020 (patch)
treec39f926df5a4daee81ea294b9edcd46742e14e18 /compiler/rustc_codegen_llvm/src/debuginfo
parent5f4e0677190b82e61dc507e3e72caf89da8e5e28 (diff)
parent456135c9c2ab17e3b6deff7c78284e8892d2495d (diff)
downloadrust-352e621368c31d7b4a6362e081586cdb931ba020.tar.gz
rust-352e621368c31d7b4a6362e081586cdb931ba020.zip
Auto merge of #94824 - Dylan-DPC:rollup-iamc09j, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #93950 (Use modern formatting for format! macros)
 - #94274 (Treat unstable lints as unknown)
 - #94368 ([1/2] Implement macro meta-variable expressions)
 - #94719 (Statically compile libstdc++ everywhere if asked)
 - #94728 (Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST)
 - #94790 (enable portable-simd doctests in Miri)
 - #94811 (Update browser-ui-test version)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index 89fc8980037..a6e4878e5b3 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -617,7 +617,9 @@ pub fn type_metadata<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>, t: Ty<'tcx>) -> &'ll
         ty::RawPtr(ty::TypeAndMut { ty: pointee_type, .. }) | ty::Ref(_, pointee_type, _) => {
             pointer_or_reference_metadata(cx, t, pointee_type, unique_type_id)
         }
-        ty::Adt(def, _) if def.is_box() => {
+        // Box<T, A> may have a non-ZST allocator A. In that case, we
+        // cannot treat Box<T, A> as just an owned alias of `*mut T`.
+        ty::Adt(def, substs) if def.is_box() && cx.layout_of(substs.type_at(1)).is_zst() => {
             pointer_or_reference_metadata(cx, t, t.boxed_ty(), unique_type_id)
         }
         ty::FnDef(..) | ty::FnPtr(_) => subroutine_type_metadata(cx, unique_type_id),