core/intrinsics/
bounds.rs1use crate::marker::PointeeSized;
4
5pub unsafe trait BuiltinDeref: Sized {
11 type Pointee: PointeeSized;
12}
13
14unsafe impl<T: PointeeSized> BuiltinDeref for &mut T {
15 type Pointee = T;
16}
17unsafe impl<T: PointeeSized> BuiltinDeref for &T {
18 type Pointee = T;
19}
20unsafe impl<T: PointeeSized> BuiltinDeref for *mut T {
21 type Pointee = T;
22}
23unsafe impl<T: PointeeSized> BuiltinDeref for *const T {
24 type Pointee = T;
25}
26
27pub trait ChangePointee<U: PointeeSized>: BuiltinDeref {
28 type Output;
29}
30impl<'a, T: PointeeSized + 'a, U: PointeeSized + 'a> ChangePointee<U> for &'a mut T {
31 type Output = &'a mut U;
32}
33impl<'a, T: PointeeSized + 'a, U: PointeeSized + 'a> ChangePointee<U> for &'a T {
34 type Output = &'a U;
35}
36impl<T: PointeeSized, U: PointeeSized> ChangePointee<U> for *mut T {
37 type Output = *mut U;
38}
39impl<T: PointeeSized, U: PointeeSized> ChangePointee<U> for *const T {
40 type Output = *const U;
41}