From 9fc6737e1bb5048b26bf3478753cb1483017fa50 Mon Sep 17 00:00:00 2001 From: bluss Date: Sat, 22 Dec 2018 14:25:16 +0100 Subject: [PATCH] FIX: Use repr(C) MaybeUninitCopy after discussion with RalfJung We have a recommendation from the unsafe-wg (no rule yet), that repr(C) for unions should work this way, so that we can cast from the union type to one of its fields. --- src/maybe_uninit_copy.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/maybe_uninit_copy.rs b/src/maybe_uninit_copy.rs index dd08e57..1a1c9ec 100644 --- a/src/maybe_uninit_copy.rs +++ b/src/maybe_uninit_copy.rs @@ -2,6 +2,7 @@ use array::Array; #[derive(Copy, Clone)] +#[repr(C)] // for cast from self ptr to value pub union MaybeUninitCopy where T: Copy {