Skip to content

Commit f5caaea

Browse files
committed
add is_sized method on Abi and Layout, and use it
1 parent ade426f commit f5caaea

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/constant.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub(crate) fn codegen_const_value<'tcx>(
128128
ty: Ty<'tcx>,
129129
) -> CValue<'tcx> {
130130
let layout = fx.layout_of(ty);
131-
assert!(!layout.is_unsized(), "sized const value");
131+
assert!(layout.is_sized(), "unsized const value");
132132

133133
if layout.is_zst() {
134134
return CValue::by_ref(crate::Pointer::dangling(layout.align.pref), layout);

src/value_and_place.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn codegen_field<'tcx>(
1919
};
2020

2121
if let Some(extra) = extra {
22-
if !field_layout.is_unsized() {
22+
if field_layout.is_sized() {
2323
return simple(fx);
2424
}
2525
match field_layout.ty.kind() {
@@ -364,7 +364,7 @@ impl<'tcx> CPlace<'tcx> {
364364
fx: &mut FunctionCx<'_, '_, 'tcx>,
365365
layout: TyAndLayout<'tcx>,
366366
) -> CPlace<'tcx> {
367-
assert!(!layout.is_unsized());
367+
assert!(layout.is_sized());
368368
if layout.size.bytes() == 0 {
369369
return CPlace {
370370
inner: CPlaceInner::Addr(Pointer::dangling(layout.align.pref), None),
@@ -825,7 +825,7 @@ impl<'tcx> CPlace<'tcx> {
825825
fx: &FunctionCx<'_, '_, 'tcx>,
826826
variant: VariantIdx,
827827
) -> Self {
828-
assert!(!self.layout().is_unsized());
828+
assert!(self.layout().is_sized());
829829
let layout = self.layout().for_variant(fx, variant);
830830
CPlace { inner: self.inner, layout }
831831
}

0 commit comments

Comments
 (0)