]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/transmutability/unions/should_permit_intersecting_if_validity_is_assumed.rs
2 //! If validity is assumed, there need only be one matching bit-pattern between
3 //! the source and destination types.
6 #![feature(transmutability)]
7 #![allow(dead_code, incomplete_features, non_camel_case_types)]
10 use std
::mem
::BikeshedIntrinsicFrom
;
13 pub fn is_maybe_transmutable
<Src
, Dst
>()
15 Dst
: BikeshedIntrinsicFrom
<Src
, Context
, false, false, true, true>
16 // validity IS assumed --------------------------------^^^^
20 #[derive(Clone, Copy)] #[repr(u8)] enum Ox00 { V = 0x00 }
21 #[derive(Clone, Copy)] #[repr(u8)] enum Ox7F { V = 0x7F }
22 #[derive(Clone, Copy)] #[repr(u8)] enum OxFF { V = 0xFF }
37 assert
::is_maybe_transmutable
::<A
, B
>();
38 assert
::is_maybe_transmutable
::<B
, A
>();