2021-07-03 11:18:13 -05:00
|
|
|
// An unknown destination type should be gracefully handled.
|
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
#![feature(transmutability)]
|
|
|
|
#![allow(dead_code, incomplete_features, non_camel_case_types)]
|
|
|
|
|
|
|
|
mod assert {
|
|
|
|
use std::mem::BikeshedIntrinsicFrom;
|
|
|
|
pub struct Context;
|
|
|
|
|
|
|
|
pub fn is_transmutable<Src, Dst, Context>()
|
|
|
|
where
|
2022-08-18 14:39:14 -05:00
|
|
|
Dst: BikeshedIntrinsicFrom<Src, Context>
|
2021-07-03 11:18:13 -05:00
|
|
|
{}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn should_gracefully_handle_unknown_dst_field() {
|
|
|
|
struct Context;
|
|
|
|
#[repr(C)] struct Src;
|
|
|
|
#[repr(C)] struct Dst(Missing); //~ cannot find type
|
2023-06-12 18:35:23 -05:00
|
|
|
assert::is_transmutable::<Src, Dst, Context>(); //~ ERROR cannot be safely transmuted
|
2021-07-03 11:18:13 -05:00
|
|
|
}
|