Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mem::zeroed/uninit: panic on types that do not permit zero-initialization #66059

Merged
merged 10 commits into from
Mar 11, 2020
4 changes: 3 additions & 1 deletion src/test/ui/intrinsics/panic-uninitialized-zeroed.rs
Original file line number Diff line number Diff line change
@@ -161,7 +161,9 @@ fn main() {
let _val = mem::zeroed::<MaybeUninit<NonNull<u32>>>();
let _val = mem::uninitialized::<MaybeUninit<bool>>();

// We don't panic for these just to be conservative. They are UB as of now (2019-11-09).
// These are UB because they have not been officially blessed, but we await the resolution
// of <https://github.com/rust-lang/unsafe-code-guidelines/issues/71> before doing
// anything about that.
let _val = mem::uninitialized::<i32>();
let _val = mem::uninitialized::<*const ()>();
}