Auto merge of #57419 - cramertj:pin-set, r=withouboats · rust-lang/rust@6ecad33 (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Commit 6ecad33

Auto merge of #57419 - cramertj:pin-set, r=withouboats

Reborrow Pin

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? @withoutboatscc @rust-lang/libs

File tree

1 file changed

lines changed

1 file changed

lines changed

Original file line number Diff line number Diff line change
@@ -175,11 +175,11 @@ impl<P: DerefMut> Pin

{

175 175 /// Assign a new value to the memory behind the pinned reference.
176 176 #[stable(feature = "pin", since = "1.33.0")]
177 177 #[inline(always)]
178 -pub fn set(mut self: Pin<P>, value: P::Target)
178 +pub fn set(self: &mut Pin<P>, value: P::Target)
179 179 where
180 180 P::Target: Sized,
181 181 {
182 -*self.pointer = value;
182 +*(self.pointer) = value;
183 183 }
184 184 }
185 185