]> git.lizzy.rs Git - rust.git/blob - src/test/ui/transmutability/references.rs
Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses...
[rust.git] / src / test / ui / transmutability / references.rs
1 //! Transmutations involving references are not yet supported.
2
3 #![crate_type = "lib"]
4 #![feature(transmutability)]
5 #![allow(dead_code, incomplete_features, non_camel_case_types)]
6
7 mod assert {
8     use std::mem::{Assume, BikeshedIntrinsicFrom};
9     pub struct Context;
10
11     pub fn is_maybe_transmutable<Src, Dst>()
12     where
13         Dst: BikeshedIntrinsicFrom<Src, Context, {
14             Assume {
15                 alignment: true,
16                 lifetimes: true,
17                 safety: true,
18                 validity: true,
19             }
20         }>
21     {}
22 }
23
24 fn not_yet_implemented() {
25     #[repr(C)] struct Unit;
26     assert::is_maybe_transmutable::<&'static Unit, &'static Unit>(); //~ ERROR cannot be safely transmuted
27 }