mirror of https://github.com/rust-lang/rfcs.git
Also modify `DispatchFromDyn` for `Pin`
This commit is contained in:
parent
7f4e36beed
commit
1eec5b3351
|
@ -646,8 +646,7 @@ introduce a `StableDeref` trait:
|
|||
unsafe trait StableDeref: Deref { }
|
||||
```
|
||||
Then we make it so that you can only coerce pinned pointers when they implement
|
||||
`StableDeref`. We can do that by modifying its implementation of
|
||||
[`CoerceUnsized`] to this:
|
||||
`StableDeref`. We can do that by modifying its trait implementations to this:
|
||||
```rs
|
||||
impl<T, U> CoerceUnsized<Pin<U>> for Pin<T>
|
||||
where
|
||||
|
@ -655,6 +654,13 @@ where
|
|||
T: StableDeref,
|
||||
U: StableDeref,
|
||||
{}
|
||||
|
||||
impl<T, U> DispatchFromDyn<Pin<U>> for Pin<T>
|
||||
where
|
||||
T: CoerceUnsized<U>,
|
||||
T: StableDeref,
|
||||
U: StableDeref,
|
||||
{}
|
||||
```
|
||||
This way, the user must implement the unsafe trait before they can coerce
|
||||
pinned versions of the pointer. Since the trait is unsafe, it is not our fault
|
||||
|
|
Loading…
Reference in New Issue