]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/transmutability/visibility/should_accept_if_src_has_private_variant.rs
2 //! The presence of a private variant in the source type does not affect
6 #![feature(transmutability)]
10 use std
::mem
::BikeshedIntrinsicFrom
;
12 pub fn is_transmutable
<Src
, Dst
, Context
>()
14 Dst
: BikeshedIntrinsicFrom
<Src
, Context
> // safety is NOT assumed
19 #[derive(Copy, Clone)]
20 #[repr(C)] pub(in super) struct Zst;
22 #[repr(C)] pub(in super) union Src {
23 pub(self) field
: Zst
, // <- private variant
28 #[repr(C)] pub(in super) struct Zst;
30 #[repr(C)] pub(in super) struct Dst {
31 pub(in super) field
: Zst
,
37 assert
::is_transmutable
::<src
::Src
, dst
::Dst
, Context
>();