2024-10-20 03:45:15 -05:00
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
2024-07-04 16:44:10 -05:00
|
|
|
mod assert {
|
2024-08-27 09:05:54 -05:00
|
|
|
use std::mem::{Assume, TransmuteFrom};
|
2024-10-20 03:45:15 -05:00
|
|
|
//~^ ERROR: use of unstable library feature 'transmutability'
|
|
|
|
//~| ERROR: use of unstable library feature 'transmutability'
|
2024-07-04 16:44:10 -05:00
|
|
|
|
|
|
|
pub fn is_transmutable<Src, Dst>()
|
|
|
|
where
|
2024-08-27 09:05:54 -05:00
|
|
|
Dst: TransmuteFrom<Src>,
|
2024-10-20 03:45:15 -05:00
|
|
|
//~^ ERROR: use of unstable library feature 'transmutability'
|
2024-07-04 16:44:10 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(u32)]
|
|
|
|
enum Ox00 {
|
|
|
|
V = 0x00,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C, packed(2))]
|
2024-10-20 03:45:15 -05:00
|
|
|
//~^ ERROR: attribute should be applied to a struct
|
2024-07-04 16:44:10 -05:00
|
|
|
enum OxFF {
|
|
|
|
V = 0xFF,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test() {
|
|
|
|
union Superset {
|
|
|
|
a: Ox00,
|
2024-10-20 03:45:15 -05:00
|
|
|
//~^ ERROR: field must implement `Copy`
|
2024-07-04 16:44:10 -05:00
|
|
|
b: OxFF,
|
|
|
|
}
|
|
|
|
|
|
|
|
assert::is_transmutable::<Superset, Subset>();
|
2024-10-20 03:45:15 -05:00
|
|
|
//~^ ERROR: cannot find type `Subset`
|
2024-07-04 16:44:10 -05:00
|
|
|
}
|