fix assumption that ScalarPair Box is always a fat pointer
This commit is contained in:
parent
393fdc1048
commit
ae32f43c50
2 changed files with 7 additions and 1 deletions
|
@ -330,7 +330,7 @@ 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);
|
||||||
}
|
}
|
||||||
ty::Adt(def, _) if def.is_box() => {
|
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);
|
||||||
}
|
}
|
||||||
|
|
6
src/test/ui/box/issue-78459-ice.rs
Normal file
6
src/test/ui/box/issue-78459-ice.rs
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
// check-pass
|
||||||
|
#![feature(allocator_api)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
Box::new_in((), &std::alloc::Global);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue