Skip to content

Commit 78a3131

Browse files
committed
Fix ice in box alloc
1 parent 0cff1d0 commit 78a3131

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/type_of.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
251251
ty::Ref(..) | ty::RawPtr(_) => {
252252
return self.field(cx, index).gcc_type(cx, true);
253253
}
254-
ty::Adt(def, _) if def.is_box() => {
254+
// only wide pointer boxes are handled as pointers
255+
// thin pointer boxes with scalar allocators are handled by the general logic below
256+
ty::Adt(def, substs) if def.is_box() && cx.layout_of(substs.type_at(1)).is_zst() => {
255257
let ptr_ty = cx.tcx.mk_mut_ptr(self.ty.boxed_ty());
256258
return cx.layout_of(ptr_ty).scalar_pair_element_gcc_type(cx, index, immediate);
257259
}

0 commit comments

Comments
 (0)