Do not intern too large aggregates.
This commit is contained in:
parent
38c86b0798
commit
db9bd9bd8c
@ -291,6 +291,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||||||
.collect::<Option<Vec<_>>>()?;
|
.collect::<Option<Vec<_>>>()?;
|
||||||
let variant = if ty.is_enum() { Some(variant) } else { None };
|
let variant = if ty.is_enum() { Some(variant) } else { None };
|
||||||
let ty = self.ecx.layout_of(ty).ok()?;
|
let ty = self.ecx.layout_of(ty).ok()?;
|
||||||
|
if ty.is_zst() {
|
||||||
|
ImmTy::uninit(ty).into()
|
||||||
|
} else if matches!(ty.abi, Abi::Scalar(..) | Abi::ScalarPair(..)) {
|
||||||
let alloc_id = self
|
let alloc_id = self
|
||||||
.ecx
|
.ecx
|
||||||
.intern_with_temp_alloc(ty, |ecx, dest| {
|
.intern_with_temp_alloc(ty, |ecx, dest| {
|
||||||
@ -309,6 +312,9 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
|
|||||||
let mplace =
|
let mplace =
|
||||||
self.ecx.raw_const_to_mplace(ConstAlloc { alloc_id, ty: ty.ty }).ok()?;
|
self.ecx.raw_const_to_mplace(ConstAlloc { alloc_id, ty: ty.ty }).ok()?;
|
||||||
mplace.into()
|
mplace.into()
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Projection(base, elem) => {
|
Projection(base, elem) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user