2024-07-13 07:14:22 -05:00
|
|
|
//@ check-pass
|
|
|
|
//@ compile-flags: -Zunpretty=expanded
|
2024-10-05 04:44:53 -05:00
|
|
|
#![feature(derive_coerce_pointee)]
|
|
|
|
use std::marker::CoercePointee;
|
2024-07-13 07:14:22 -05:00
|
|
|
|
|
|
|
pub trait MyTrait<T: ?Sized> {}
|
|
|
|
|
2024-10-05 04:44:53 -05:00
|
|
|
#[derive(CoercePointee)]
|
2024-07-13 07:14:22 -05:00
|
|
|
#[repr(transparent)]
|
|
|
|
struct MyPointer<'a, #[pointee] T: ?Sized> {
|
|
|
|
ptr: &'a T,
|
|
|
|
}
|
|
|
|
|
2024-10-05 04:44:53 -05:00
|
|
|
#[derive(core::marker::CoercePointee)]
|
2024-07-13 07:14:22 -05:00
|
|
|
#[repr(transparent)]
|
|
|
|
pub struct MyPointer2<'a, Y, Z: MyTrait<T>, #[pointee] T: ?Sized + MyTrait<T>, X: MyTrait<T> = ()>
|
|
|
|
where
|
|
|
|
Y: MyTrait<T>,
|
|
|
|
{
|
|
|
|
data: &'a mut T,
|
|
|
|
x: core::marker::PhantomData<X>,
|
|
|
|
}
|
2024-08-23 08:07:18 -05:00
|
|
|
|
2024-10-05 04:44:53 -05:00
|
|
|
#[derive(CoercePointee)]
|
2024-08-23 08:07:18 -05:00
|
|
|
#[repr(transparent)]
|
|
|
|
struct MyPointerWithoutPointee<'a, T: ?Sized> {
|
|
|
|
ptr: &'a T,
|
|
|
|
}
|