diff options
| author | Noa <coolreader18@gmail.com> | 2024-08-23 13:06:26 -0500 |
|---|---|---|
| committer | Noa <coolreader18@gmail.com> | 2024-08-23 13:06:26 -0500 |
| commit | c65ef3d37c312dc0404da8b5c3f781d376778aad (patch) | |
| tree | 3aecee71001f8fa8f8f467c5f87d058ff68353eb | |
| parent | b968b26c03510c80782c4524a334f5fa440cb2d8 (diff) | |
| download | rust-c65ef3d37c312dc0404da8b5c3f781d376778aad.tar.gz rust-c65ef3d37c312dc0404da8b5c3f781d376778aad.zip | |
Move into_inner_unchecked back to the bottom of the impl block
| -rw-r--r-- | library/core/src/pin.rs | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/library/core/src/pin.rs b/library/core/src/pin.rs index 1ad509892d2..0f9e6061c32 100644 --- a/library/core/src/pin.rs +++ b/library/core/src/pin.rs @@ -1356,31 +1356,6 @@ impl<Ptr: Deref> Pin<Ptr> { Pin { __pointer: pointer } } - /// Unwraps this `Pin<Ptr>`, returning the underlying `Ptr`. - /// - /// # Safety - /// - /// This function is unsafe. You must guarantee that you will continue to - /// treat the pointer `Ptr` as pinned after you call this function, so that - /// the invariants on the `Pin` type can be upheld. If the code using the - /// resulting `Ptr` does not continue to maintain the pinning invariants that - /// is a violation of the API contract and may lead to undefined behavior in - /// later (safe) operations. - /// - /// Note that you must be able to guarantee that the data pointed to by `Ptr` - /// will be treated as pinned all the way until its `drop` handler is complete! - /// - /// *For more information, see the [`pin` module docs][self]* - /// - /// If the underlying data is [`Unpin`], [`Pin::into_inner`] should be used - /// instead. - #[inline(always)] - #[rustc_const_unstable(feature = "const_pin", issue = "76654")] - #[stable(feature = "pin_into_inner", since = "1.39.0")] - pub const unsafe fn into_inner_unchecked(pin: Pin<Ptr>) -> Ptr { - pin.__pointer - } - /// Gets a shared reference to the pinned value this [`Pin`] points to. /// /// This is a generic method to go from `&Pin<Pointer<T>>` to `Pin<&T>`. @@ -1504,6 +1479,31 @@ impl<Ptr: Deref> Pin<Ptr> { { *(self.__pointer) = value; } + + /// Unwraps this `Pin<Ptr>`, returning the underlying `Ptr`. + /// + /// # Safety + /// + /// This function is unsafe. You must guarantee that you will continue to + /// treat the pointer `Ptr` as pinned after you call this function, so that + /// the invariants on the `Pin` type can be upheld. If the code using the + /// resulting `Ptr` does not continue to maintain the pinning invariants that + /// is a violation of the API contract and may lead to undefined behavior in + /// later (safe) operations. + /// + /// Note that you must be able to guarantee that the data pointed to by `Ptr` + /// will be treated as pinned all the way until its `drop` handler is complete! + /// + /// *For more information, see the [`pin` module docs][self]* + /// + /// If the underlying data is [`Unpin`], [`Pin::into_inner`] should be used + /// instead. + #[inline(always)] + #[rustc_const_unstable(feature = "const_pin", issue = "76654")] + #[stable(feature = "pin_into_inner", since = "1.39.0")] + pub const unsafe fn into_inner_unchecked(pin: Pin<Ptr>) -> Ptr { + pin.__pointer + } } impl<'a, T: ?Sized> Pin<&'a T> { |
