2 //! The presence of an `align(X)` annotation must be accounted for.
5 #![feature(transmutability)]
6 #![allow(dead_code, incomplete_features, non_camel_case_types)]
9 use std
::mem
::{Assume, BikeshedIntrinsicFrom}
;
12 pub fn is_maybe_transmutable
<Src
, Dst
>()
14 Dst
: BikeshedIntrinsicFrom
<Src
, Context
, {
25 fn should_pad_explicitly_aligned_field() {
26 #[derive(Clone, Copy)] #[repr(u8)] enum V0u8 { V = 0 }
27 #[derive(Clone, Copy)] #[repr(u8)] enum V1u8 { V = 1 }
40 #[repr(C)] struct ImplicitlyPadded(align_2, V0u8);
41 #[repr(C)] struct ExplicitlyPadded(V0u8, Uninit, V0u8);
43 // An implementation that (incorrectly) does not place a padding byte after
44 // `align_2` will, incorrectly, reject the following transmutations.
45 assert
::is_maybe_transmutable
::<ImplicitlyPadded
, ExplicitlyPadded
>();
46 assert
::is_maybe_transmutable
::<ExplicitlyPadded
, ImplicitlyPadded
>();