rust/tests/ui/layout/thaw-transmute-invalid-enum.rs
dianne d7d6238b23 use backticks instead of single quotes when reporting "use of unstable library feature"
This is consistent with all other diagnostics I could find containing
features and enables the use of `DiagSymbolList` for generalizing
diagnostics for unstable library features to multiple features.
2024-11-03 13:55:52 -08:00

37 lines
742 B
Rust

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