about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTaylor Cramer <cramertj@google.com>2018-09-18 11:48:03 -0700
committerTaylor Cramer <cramertj@google.com>2018-09-18 15:42:51 -0700
commit574bca7262f0ddab9e1818253012dbff34755b98 (patch)
tree4ad1ccf98cd7c4a2d8250351d80bdd78afbf1a09 /src/libcore
parent403d12d696a344cd6a9251e46c313e00f0316f9b (diff)
downloadrust-574bca7262f0ddab9e1818253012dbff34755b98.tar.gz
rust-574bca7262f0ddab9e1818253012dbff34755b98.zip
Cleanup Deref impls and add ?Sized bound to &mut T impls
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/pin.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs
index 3ab6dcd8531..d09a545aecf 100644
--- a/src/libcore/pin.rs
+++ b/src/libcore/pin.rs
@@ -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) }
     }
 }
 
@@ -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)]
@@ -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))
     }
 }
 
@@ -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))
     }
 }