explain unsafe

This commit is contained in:
Ralf Jung 2019-02-21 15:33:55 +01:00
parent bcc55e5e79
commit 6b88007473

View file

@ -359,8 +359,8 @@ impl<P: Deref> Pin<P> {
/// This constructor is unsafe because we cannot guarantee that the data /// This constructor is unsafe because we cannot guarantee that the data
/// pointed to by `pointer` is pinned, meaning that the data will not be moved or /// pointed to by `pointer` is pinned, meaning that the data will not be moved or
/// its storage invalidated until it gets dropped. If the constructed `Pin<P>` does /// its storage invalidated until it gets dropped. If the constructed `Pin<P>` does
/// not guarantee that the data `P` points to is pinned, constructing a /// not guarantee that the data `P` points to is pinned, that is a violation of
/// `Pin<P>` is unsafe. /// the API contract and may lead to undefined behavior in later (safe) operations.
/// ///
/// By using this method, you are making a promise about the `P::Deref` and /// By using this method, you are making a promise about the `P::Deref` and
/// `P::DerefMut` implementations, if they exist. Most importantly, they /// `P::DerefMut` implementations, if they exist. Most importantly, they