]> git.lizzy.rs Git - rust.git/blob - src/test/ui/transmutability/primitives/bool.rs
Rollup merge of #100030 - WaffleLapkin:nice_pointer_sis, r=scottmcm
[rust.git] / src / test / ui / transmutability / primitives / bool.rs
1 #![crate_type = "lib"]
2 #![feature(transmutability)]
3 #![allow(dead_code)]
4 #![allow(incomplete_features)]
5
6 mod assert {
7     use std::mem::BikeshedIntrinsicFrom;
8     pub struct Context;
9
10     pub fn is_transmutable<Src, Dst>()
11     where
12         Dst: BikeshedIntrinsicFrom<Src, Context, false, false, false, true>
13     {}
14
15     pub fn is_maybe_transmutable<Src, Dst>()
16     where
17         Dst: BikeshedIntrinsicFrom<Src, Context, false, false, true, true>
18     {}
19 }
20
21 fn contrast_with_u8() {
22     assert::is_transmutable::<u8, bool>(); //~ ERROR cannot be safely transmuted
23     assert::is_maybe_transmutable::<u8, bool>();
24     assert::is_transmutable::<bool, u8>();
25 }