about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDrMeepster <19316085+DrMeepster@users.noreply.github.com>2022-02-16 16:52:06 -0800
committerGitHub <noreply@github.com>2022-02-16 16:52:06 -0800
commitd0b508e1a7d7f0408a782193c78e7b2ee052ef3b (patch)
treeb341cf3432bf4d82d3564fb843cbdc0a0291996f
parentae32f43c50fc72ba2812c18053c34d1b94aa5e3f (diff)
downloadrust-d0b508e1a7d7f0408a782193c78e7b2ee052ef3b.tar.gz
rust-d0b508e1a7d7f0408a782193c78e7b2ee052ef3b.zip
add comment explaining the check
-rw-r--r--compiler/rustc_codegen_llvm/src/type_of.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/type_of.rs b/compiler/rustc_codegen_llvm/src/type_of.rs
index 24e158b489b..fafb9a6dbde 100644
--- a/compiler/rustc_codegen_llvm/src/type_of.rs
+++ b/compiler/rustc_codegen_llvm/src/type_of.rs
@@ -330,6 +330,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
             ty::Ref(..) | ty::RawPtr(_) => {
                 return self.field(cx, index).llvm_type(cx);
             }
+            // only wide pointer boxes are handled as pointers
+            // thin pointer boxes with scalar allocators are handled by the general logic below
             ty::Adt(def, substs) if def.is_box() && cx.layout_of(substs.type_at(1)).is_zst() => {
                 let ptr_ty = cx.tcx.mk_mut_ptr(self.ty.boxed_ty());
                 return cx.layout_of(ptr_ty).scalar_pair_element_llvm_type(cx, index, immediate);