mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-02 15:32:06 +00:00
add comment explaining the check
This commit is contained in:
parent
ae32f43c50
commit
d0b508e1a7
@ -330,6 +330,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
|
|||||||
ty::Ref(..) | ty::RawPtr(_) => {
|
ty::Ref(..) | ty::RawPtr(_) => {
|
||||||
return self.field(cx, index).llvm_type(cx);
|
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() => {
|
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());
|
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);
|
return cx.layout_of(ptr_ty).scalar_pair_element_llvm_type(cx, index, immediate);
|
||||||
|
Loading…
Reference in New Issue
Block a user