2023-04-28 16:06:10 -05:00
|
|
|
//@ check-pass
|
2021-07-03 11:18:13 -05:00
|
|
|
#![feature(transmutability)]
|
|
|
|
|
|
|
|
mod assert {
|
2022-08-18 14:39:14 -05:00
|
|
|
use std::mem::{Assume, BikeshedIntrinsicFrom};
|
2021-07-03 11:18:13 -05:00
|
|
|
|
|
|
|
pub fn is_maybe_transmutable<Src, Dst>()
|
|
|
|
where
|
2024-02-26 10:49:25 -06:00
|
|
|
Dst: BikeshedIntrinsicFrom<Src, {
|
2022-08-18 14:39:14 -05:00
|
|
|
Assume {
|
2023-04-28 16:06:10 -05:00
|
|
|
alignment: false,
|
2022-08-18 14:39:14 -05:00
|
|
|
lifetimes: true,
|
|
|
|
safety: true,
|
2023-04-28 16:06:10 -05:00
|
|
|
validity: false,
|
2022-08-18 14:39:14 -05:00
|
|
|
}
|
|
|
|
}>
|
2021-07-03 11:18:13 -05:00
|
|
|
{}
|
|
|
|
}
|
|
|
|
|
2023-04-21 18:49:36 -05:00
|
|
|
fn main() {
|
2021-07-03 11:18:13 -05:00
|
|
|
#[repr(C)] struct Unit;
|
2023-04-28 16:06:10 -05:00
|
|
|
assert::is_maybe_transmutable::<&'static u8, &'static Unit>();
|
2021-07-03 11:18:13 -05:00
|
|
|
}
|