diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-03-10 23:13:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-10 23:13:00 +0100 |
| commit | b18b2d1bcd07ac90cbae0918f344e8e723fe7688 (patch) | |
| tree | 9e674a89afba743410a4aa7d7e8c7c04f587fc58 /compiler/rustc_codegen_llvm/src | |
| parent | 1cf879355ba39946f59bb90149b09d3b85567230 (diff) | |
| parent | 307ee94a8a535019feadf69ce4258cdfb67a3a1c (diff) | |
| download | rust-b18b2d1bcd07ac90cbae0918f344e8e723fe7688.tar.gz rust-b18b2d1bcd07ac90cbae0918f344e8e723fe7688.zip | |
Rollup merge of #94728 - compiler-errors:box-allocator-zst-meta, r=michaelwoerister
Only emit pointer-like metadata for `Box<T, A>` when `A` is ZST Basically copy the change in #94043, but for debuginfo. r? ``@michaelwoerister`` Fixes #94725
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 4 |
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), |
