Skip to content

Commit 6ecad33

Browse files
committed
Auto merge of #57419 - cramertj:pin-set, r=withouboats
Reborrow Pin<P> using &mut in `Pin::set` Fixes #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
2 parents 664c779 + 68e98a2 commit 6ecad33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/pin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@ impl<P: DerefMut> Pin<P> {
175175
/// Assign a new value to the memory behind the pinned reference.
176176
#[stable(feature = "pin", since = "1.33.0")]
177177
#[inline(always)]
178-
pub fn set(mut self: Pin<P>, value: P::Target)
178+
pub fn set(self: &mut Pin<P>, value: P::Target)
179179
where
180180
P::Target: Sized,
181181
{
182-
*self.pointer = value;
182+
*(self.pointer) = value;
183183
}
184184
}
185185

0 commit comments

Comments
 (0)