diff options
| author | bors <bors@rust-lang.org> | 2019-01-09 13:48:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-01-09 13:48:37 +0000 |
| commit | 6ecad338381cc3b8d56e2df22e5971a598eddd6c (patch) | |
| tree | a3801d480d3ea835621d8336ea8c09cb99c59414 | |
| parent | 664c7797f6bfddf9f5e67474c2fd8017f91d7110 (diff) | |
| parent | 68e98a2a858a60462501ea2a9097fe94d70ff993 (diff) | |
| download | rust-6ecad338381cc3b8d56e2df22e5971a598eddd6c.tar.gz rust-6ecad338381cc3b8d56e2df22e5971a598eddd6c.zip | |
Auto merge of #57419 - cramertj:pin-set, r=withouboats
Reborrow Pin<P> using &mut in `Pin::set` Fixes https://github.com/rust-lang/rust/issues/57339. This makes it possible to call `.set` multiple times without using `.as_mut()` first to reborrow the pointer. r? @withoutboats cc @rust-lang/libs
| -rw-r--r-- | src/libcore/pin.rs | 4 |
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; } } |
