Allow checking whether a type allows being uninitialized

This is useful for clippy and for the future `MaybeUninit::assume_init`
panics.
This commit is contained in:
Nilstrieb
2023-03-02 18:33:48 +00:00
parent 7e966bcd03
commit 10a69de5fd
3 changed files with 11 additions and 2 deletions

View File

@@ -444,6 +444,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
"aborted execution: attempted to leave type `{}` uninitialized, which is invalid",
ty
),
ValidityRequirement::Uninit => bug!("assert_uninit_valid doesn't exist"),
};
M::abort(self, msg)?;