about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorTaylor Cramer <cramertj@google.com>2019-01-07 11:45:34 -0800
committerTaylor Cramer <cramertj@google.com>2019-01-07 11:45:34 -0800
commit68e98a2a858a60462501ea2a9097fe94d70ff993 (patch)
treec913a791c9847c49d1481caee17becc4ac8511f4 /src/libcore
parent21ac19d8fefb023752645fcf2517ce0fad663bf0 (diff)
downloadrust-68e98a2a858a60462501ea2a9097fe94d70ff993.tar.gz
rust-68e98a2a858a60462501ea2a9097fe94d70ff993.zip
Reborrow Pin<P> using &mut in `Pin::set`
This makes it possible to call `.set` multiple times without
using `.as_mut()` first to reborrow the pointer.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/pin.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs
index e31ac691e3a..762e07549a5 100644
--- a/src/libcore/pin.rs
+++ b/src/libcore/pin.rs
@@ -175,11 +175,11 @@ impl<P: DerefMut> Pin<P> {
     /// Assign a new value to the memory behind the pinned reference.
     #[stable(feature = "pin", since = "1.33.0")]
     #[inline(always)]
-    pub fn set(mut self: Pin<P>, value: P::Target)
+    pub fn set(self: &mut Pin<P>, value: P::Target)
     where
         P::Target: Sized,
     {
-        *self.pointer = value;
+        *(self.pointer) = value;
     }
 }