From 68e98a2a858a60462501ea2a9097fe94d70ff993 Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Mon, 7 Jan 2019 11:45:34 -0800 Subject: [PATCH] Reborrow Pin

using &mut in `Pin::set` This makes it possible to call `.set` multiple times without using `.as_mut()` first to reborrow the pointer. --- src/libcore/pin.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcore/pin.rs b/src/libcore/pin.rs index e31ac691e3a3c..762e07549a52a 100644 --- a/src/libcore/pin.rs +++ b/src/libcore/pin.rs @@ -175,11 +175,11 @@ impl Pin

{ /// 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

, value: P::Target) + pub fn set(self: &mut Pin

, value: P::Target) where P::Target: Sized, { - *self.pointer = value; + *(self.pointer) = value; } }