Skip to content

Commit 94a5c3b

Browse files
committed
Remove [mut] syntax in pin docs
1 parent 3de0106 commit 94a5c3b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libcore/pin.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@
158158
//! is called *even if your type was previously pinned*! It is as if the
159159
//! compiler automatically called `get_unchecked_mut`.
160160
//!
161-
//! This can never cause a problem in safe code because implementing a type that relies on pinning
162-
//! requires unsafe code, but be aware that deciding to make use of pinning
163-
//! in your type (for example by implementing some operation on `Pin<&[mut] Self>`)
164-
//! has consequences for your `Drop` implementation as well: if an element
165-
//! of your type could have been pinned, you must treat Drop as implicitly taking
166-
//! `Pin<&mut Self>`.
161+
//! This can never cause a problem in safe code because implementing a type that
162+
//! relies on pinning requires unsafe code, but be aware that deciding to make
163+
//! use of pinning in your type (for example by implementing some operation on
164+
//! `Pin<&Self>` or `Pin<&mut Self>`) has consequences for your `Drop`
165+
//! implementation as well: if an element of your type could have been pinned,
166+
//! you must treat Drop as implicitly taking `Pin<&mut Self>`.
167167
//!
168168
//! In particular, if your type is `#[repr(packed)]`, the compiler will automatically
169169
//! move fields around to be able to drop them. As a consequence, you cannot use
@@ -173,13 +173,13 @@
173173
//!
174174
//! One interesting question arises when considering the interaction of pinning and
175175
//! the fields of a struct. When can a struct have a "pinning projection", i.e.,
176-
//! an operation with type `fn(Pin<&[mut] Struct>) -> Pin<&[mut] Field>`?
176+
//! an operation with type `fn(Pin<&Struct>) -> Pin<&Field>`?
177177
//! In a similar vein, when can a generic wrapper type (such as `Vec<T>`, `Box<T>`, or `RefCell<T>`)
178-
//! have an operation with type `fn(Pin<&[mut] Wrapper<T>>) -> Pin<&[mut] T>`?
178+
//! have an operation with type `fn(Pin<&Wrapper<T>>) -> Pin<&T>`?
179179
//!
180180
//! Having a pinning projection for some field means that pinning is "structural":
181181
//! when the wrapper is pinned, the field must be considered pinned, too.
182-
//! After all, the pinning projection lets us get a `Pin<&[mut] Field>`.
182+
//! After all, the pinning projection lets us get a `Pin<&Field>`.
183183
//!
184184
//! However, structural pinning comes with a few extra requirements, so not all
185185
//! wrappers can be structural and hence not all wrappers can offer pinning projections:

0 commit comments

Comments
 (0)