1
Fork 0

Rollup merge of #104357 - RalfJung:is-sized, r=cjgillot

add is_sized method on Abi and Layout, and use it

This avoids the double negation of `!is_unsized()` that we have quite a lot.
This commit is contained in:
Matthias Krüger 2022-11-13 17:37:38 +01:00 committed by GitHub
commit 8076b5903a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 39 additions and 29 deletions

View file

@ -1083,6 +1083,11 @@ impl Abi {
}
}
#[inline]
pub fn is_sized(&self) -> bool {
!self.is_unsized()
}
/// Returns `true` if this is a single signed integer scalar
#[inline]
pub fn is_signed(&self) -> bool {
@ -1490,6 +1495,11 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
self.abi.is_unsized()
}
#[inline]
pub fn is_sized(&self) -> bool {
self.abi.is_sized()
}
/// Returns `true` if the type is a ZST and not unsized.
pub fn is_zst(&self) -> bool {
match self.abi {