diff options
| author | Ralf Jung <post@ralfj.de> | 2022-11-13 12:14:59 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-11-13 12:23:53 +0100 |
| commit | f5caaea98a394f5186b6dbf99fcf1b2ad9ad78a0 (patch) | |
| tree | b7b8376df14945cec335332b03b147d5e18c5319 | |
| parent | ade426fa83a4840a3940aee184e8b65ecfeeb6aa (diff) | |
| download | rust-f5caaea98a394f5186b6dbf99fcf1b2ad9ad78a0.tar.gz rust-f5caaea98a394f5186b6dbf99fcf1b2ad9ad78a0.zip | |
add is_sized method on Abi and Layout, and use it
| -rw-r--r-- | src/constant.rs | 2 | ||||
| -rw-r--r-- | src/value_and_place.rs | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/constant.rs b/src/constant.rs index 148b66d959e..df1150ec0b8 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -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); diff --git a/src/value_and_place.rs b/src/value_and_place.rs index c3dfbd37279..c5bd574623d 100644 --- a/src/value_and_place.rs +++ b/src/value_and_place.rs @@ -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 } } |
