Skip to content

Commit

Permalink
Cleanup Deref impls and add ?Sized bound to &mut T impls
Browse files Browse the repository at this point in the history
  • Loading branch information
cramertj committed Sep 18, 2018
1 parent 403d12d commit 574bca7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcore/pin.rs
Expand Up @@ -154,7 +154,7 @@ impl<P: Deref> Pin<P> {
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
pub fn as_ref(self: &Pin<P>) -> Pin<&P::Target> {
unsafe { Pin::new_unchecked(&**self) }
unsafe { Pin::new_unchecked(&*self.pointer) }
}
}

Expand Down Expand Up @@ -212,7 +212,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
}
}

impl<'a, T> Pin<&'a mut T> {
impl<'a, T: ?Sized> Pin<&'a mut T> {
/// Convert this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
#[unstable(feature = "pin", issue = "49150")]
#[inline(always)]
Expand Down Expand Up @@ -278,7 +278,7 @@ impl<'a, T> Pin<&'a mut T> {
impl<P: Deref> Deref for Pin<P> {
type Target = P::Target;
fn deref(&self) -> &P::Target {
&*self.pointer
Pin::get_ref(Pin::as_ref(self))
}
}

Expand All @@ -288,7 +288,7 @@ where
P::Target: Unpin
{
fn deref_mut(&mut self) -> &mut P::Target {
&mut *self.pointer
Pin::get_mut(Pin::as_mut(self))
}
}

Expand Down

0 comments on commit 574bca7

Please sign in to comment.