2021-12-02 20:30:35 +01:00
|
|
|
#[repr(C)]
|
|
|
|
union PtrRepr<T: ?Sized> {
|
|
|
|
const_ptr: *const T,
|
|
|
|
mut_ptr: *mut T,
|
|
|
|
components: PtrComponents<T>,
|
|
|
|
//~^ ERROR the trait bound
|
2023-10-25 10:49:24 +00:00
|
|
|
//~| ERROR field must implement `Copy`
|
2021-12-02 20:30:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#[repr(C)]
|
|
|
|
struct PtrComponents<T: Pointee + ?Sized> {
|
2024-01-27 14:08:29 +01:00
|
|
|
data_pointer: *const (),
|
2021-12-02 20:30:35 +01:00
|
|
|
metadata: <T as Pointee>::Metadata,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub trait Pointee {
|
|
|
|
type Metadata;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|