1
Fork 0

Unify validity checks into a single query

Previously, there were two queries to check whether a type allows the
0x01 or zeroed bitpattern.

I am planning on adding a further initness to check, truly uninit for
MaybeUninit, which would make this three queries. This seems overkill
for such a small feature, so this PR unifies them into one.
This commit is contained in:
Nilstrieb 2023-02-22 20:51:29 +00:00
parent b869e84e58
commit 025d2a147f
11 changed files with 89 additions and 67 deletions

View file

@ -1505,14 +1505,6 @@ pub struct PointeeInfo {
pub safe: Option<PointerKind>,
}
/// Used in `might_permit_raw_init` to indicate the kind of initialisation
/// that is checked to be valid
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum InitKind {
Zero,
UninitMitigated0x01Fill,
}
impl LayoutS {
/// Returns `true` if the layout corresponds to an unsized type.
pub fn is_unsized(&self) -> bool {