|
923 | 923 | use crate::cmp;
|
924 | 924 | use crate::fmt;
|
925 | 925 | use crate::hash::{Hash, Hasher};
|
926 |
| -use crate::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver}; |
| 926 | +use crate::ops::{ |
| 927 | + CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver, StableDeref, |
| 928 | +}; |
927 | 929 |
|
928 | 930 | #[allow(unused_imports)]
|
929 | 931 | use crate::{
|
@@ -1717,10 +1719,29 @@ impl<Ptr: fmt::Pointer> fmt::Pointer for Pin<Ptr> {
|
1717 | 1719 | // for other reasons, though, so we just need to take care not to allow such
|
1718 | 1720 | // impls to land in std.
|
1719 | 1721 | #[stable(feature = "pin", since = "1.33.0")]
|
1720 |
| -impl<Ptr, U> CoerceUnsized<Pin<U>> for Pin<Ptr> where Ptr: CoerceUnsized<U> {} |
| 1722 | +impl<Ptr, U> CoerceUnsized<Pin<U>> for Pin<Ptr> |
| 1723 | +where |
| 1724 | + Ptr: CoerceUnsized<U> + StableDeref, |
| 1725 | + U: StableDeref, |
| 1726 | +{ |
| 1727 | +} |
| 1728 | + |
| 1729 | +#[stable(feature = "pin", since = "1.33.0")] |
| 1730 | +impl<Ptr, U> DispatchFromDyn<Pin<U>> for Pin<Ptr> |
| 1731 | +where |
| 1732 | + Ptr: DispatchFromDyn<U> + StableDeref, |
| 1733 | + U: StableDeref, |
| 1734 | +{ |
| 1735 | +} |
| 1736 | + |
| 1737 | +#[stable(feature = "pin", since = "1.33.0")] |
| 1738 | +unsafe impl<'a, T: ?Sized> StableDeref for &'a T {} |
| 1739 | + |
| 1740 | +#[stable(feature = "pin", since = "1.33.0")] |
| 1741 | +unsafe impl<'a, T: ?Sized> StableDeref for &'a mut T {} |
1721 | 1742 |
|
1722 | 1743 | #[stable(feature = "pin", since = "1.33.0")]
|
1723 |
| -impl<Ptr, U> DispatchFromDyn<Pin<U>> for Pin<Ptr> where Ptr: DispatchFromDyn<U> {} |
| 1744 | +unsafe impl<T: StableDeref> StableDeref for Pin<T> {} |
1724 | 1745 |
|
1725 | 1746 | /// Constructs a <code>[Pin]<[&mut] T></code>, by pinning a `value: T` locally.
|
1726 | 1747 | ///
|
|
0 commit comments