blob: 090c1fea6dbdf64d03b12d5374038d706018240f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// check-pass
#![feature(transmutability)]
mod assert {
use std::mem::{Assume, BikeshedIntrinsicFrom};
pub struct Context;
pub fn is_maybe_transmutable<Src, Dst>()
where
Dst: BikeshedIntrinsicFrom<Src, Context, {
Assume {
alignment: true,
lifetimes: false,
safety: true,
validity: false,
}
}>
{}
}
fn main() {
#[repr(C)] struct A(&'static B);
#[repr(C)] struct B(&'static A);
assert::is_maybe_transmutable::<&'static A, &'static B>();
assert::is_maybe_transmutable::<&'static B, &'static A>();
}
|