add is_sized method on Abi and Layout, and use it
This commit is contained in:
parent
ade426fa83
commit
f5caaea98a
@ -128,7 +128,7 @@ pub(crate) fn codegen_const_value<'tcx>(
|
||||
ty: Ty<'tcx>,
|
||||
) -> CValue<'tcx> {
|
||||
let layout = fx.layout_of(ty);
|
||||
assert!(!layout.is_unsized(), "sized const value");
|
||||
assert!(layout.is_sized(), "unsized const value");
|
||||
|
||||
if layout.is_zst() {
|
||||
return CValue::by_ref(crate::Pointer::dangling(layout.align.pref), layout);
|
||||
|
@ -19,7 +19,7 @@ fn codegen_field<'tcx>(
|
||||
};
|
||||
|
||||
if let Some(extra) = extra {
|
||||
if !field_layout.is_unsized() {
|
||||
if field_layout.is_sized() {
|
||||
return simple(fx);
|
||||
}
|
||||
match field_layout.ty.kind() {
|
||||
@ -364,7 +364,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
fx: &mut FunctionCx<'_, '_, 'tcx>,
|
||||
layout: TyAndLayout<'tcx>,
|
||||
) -> CPlace<'tcx> {
|
||||
assert!(!layout.is_unsized());
|
||||
assert!(layout.is_sized());
|
||||
if layout.size.bytes() == 0 {
|
||||
return CPlace {
|
||||
inner: CPlaceInner::Addr(Pointer::dangling(layout.align.pref), None),
|
||||
@ -825,7 +825,7 @@ impl<'tcx> CPlace<'tcx> {
|
||||
fx: &FunctionCx<'_, '_, 'tcx>,
|
||||
variant: VariantIdx,
|
||||
) -> Self {
|
||||
assert!(!self.layout().is_unsized());
|
||||
assert!(self.layout().is_sized());
|
||||
let layout = self.layout().for_variant(fx, variant);
|
||||
CPlace { inner: self.inner, layout }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user