1 //! If visibility is assumed, a transmutation should be accepted even if the
2 //! destination type contains an unreachable field (e.g., a public field with a
3 //! private type). (This rule is distinct from type privacy, which still may
4 //! forbid naming such types.)
7 #![feature(transmutability)]
11 use std::mem::{Assume, BikeshedIntrinsicFrom};
13 pub fn is_transmutable<Src, Dst, Context>()
15 Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }>
16 // safety IS assumed --------------------^^^^^^^^^^^^^^^^^^
21 #[repr(C)] pub(self) struct Zst;
23 #[repr(C)] pub(in super) struct Src {
29 #[repr(C)] pub(in super) struct Zst;
32 #[repr(C)] pub(self) struct Dst {
33 pub(in super) field: Zst,
39 assert::is_transmutable::<src::Src, dst::Dst, Context>(); //~ ERROR `Dst` is private