Skip to content

Commit d0b508e

Browse files
authored
add comment explaining the check
1 parent ae32f43 commit d0b508e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

compiler/rustc_codegen_llvm/src/type_of.rs

+2
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
330330
ty::Ref(..) | ty::RawPtr(_) => {
331331
return self.field(cx, index).llvm_type(cx);
332332
}
333+
// only wide pointer boxes are handled as pointers
334+
// thin pointer boxes with scalar allocators are handled by the general logic below
333335
ty::Adt(def, substs) if def.is_box() && cx.layout_of(substs.type_at(1)).is_zst() => {
334336
let ptr_ty = cx.tcx.mk_mut_ptr(self.ty.boxed_ty());
335337
return cx.layout_of(ptr_ty).scalar_pair_element_llvm_type(cx, index, immediate);

0 commit comments

Comments
 (0)