2022-10-03 17:51:18 +09:00
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
#![feature(transmutability)]
|
|
|
|
|
#![allow(dead_code, incomplete_features, non_camel_case_types)]
|
|
|
|
|
|
|
|
|
|
mod assert {
|
2024-08-27 14:05:54 +00:00
|
|
|
use std::mem::TransmuteFrom;
|
2022-10-03 17:51:18 +09:00
|
|
|
|
|
|
|
|
pub fn is_transmutable<
|
|
|
|
|
Src,
|
|
|
|
|
Dst,
|
|
|
|
|
const ASSUME_ALIGNMENT: bool,
|
|
|
|
|
const ASSUME_LIFETIMES: bool,
|
|
|
|
|
const ASSUME_VALIDITY: bool,
|
|
|
|
|
const ASSUME_VISIBILITY: bool,
|
|
|
|
|
>()
|
|
|
|
|
where
|
2024-08-27 14:05:54 +00:00
|
|
|
Dst: TransmuteFrom<
|
2024-08-19 01:14:09 +01:00
|
|
|
//~^ ERROR trait takes at most 2 generic arguments but 5 generic arguments were supplied
|
|
|
|
|
Src,
|
2024-09-08 01:49:25 -04:00
|
|
|
ASSUME_ALIGNMENT,
|
2024-08-19 01:14:09 +01:00
|
|
|
ASSUME_LIFETIMES,
|
|
|
|
|
ASSUME_VALIDITY,
|
|
|
|
|
ASSUME_VISIBILITY,
|
|
|
|
|
>,
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-10-03 17:51:18 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn via_const() {
|
2024-08-19 01:14:09 +01:00
|
|
|
#[repr(C)]
|
|
|
|
|
struct Src;
|
|
|
|
|
#[repr(C)]
|
|
|
|
|
struct Dst;
|
2022-10-03 17:51:18 +09:00
|
|
|
|
|
|
|
|
const FALSE: bool = false;
|
|
|
|
|
|
2024-02-26 16:49:25 +00:00
|
|
|
assert::is_transmutable::<Src, Dst, FALSE, FALSE, FALSE, FALSE>();
|
2022-10-03 17:51:18 +09:00
|
|
|
}
|