Skip to content

Commit

Permalink
Auto merge of rust-lang#57419 - cramertj:pin-set, r=withouboats
Browse files Browse the repository at this point in the history
Reborrow Pin<P> using &mut in `Pin::set`

Fixes rust-lang#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
  • Loading branch information
bors committed Jan 9, 2019
2 parents 664c779 + 68e98a2 commit 6ecad33
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 6ecad33

Please sign in to comment.