Skip to content

Commit 976fb4a

Browse files
committed
Move into_inner_unchecked back to the bottom of the impl block
1 parent 2741e8d commit 976fb4a

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

Diff for: core/src/pin.rs

+25-25
Original file line numberDiff line numberDiff line change
@@ -1356,31 +1356,6 @@ impl<Ptr: Deref> Pin<Ptr> {
13561356
Pin { __pointer: pointer }
13571357
}
13581358

1359-
/// Unwraps this `Pin<Ptr>`, returning the underlying `Ptr`.
1360-
///
1361-
/// # Safety
1362-
///
1363-
/// This function is unsafe. You must guarantee that you will continue to
1364-
/// treat the pointer `Ptr` as pinned after you call this function, so that
1365-
/// the invariants on the `Pin` type can be upheld. If the code using the
1366-
/// resulting `Ptr` does not continue to maintain the pinning invariants that
1367-
/// is a violation of the API contract and may lead to undefined behavior in
1368-
/// later (safe) operations.
1369-
///
1370-
/// Note that you must be able to guarantee that the data pointed to by `Ptr`
1371-
/// will be treated as pinned all the way until its `drop` handler is complete!
1372-
///
1373-
/// *For more information, see the [`pin` module docs][self]*
1374-
///
1375-
/// If the underlying data is [`Unpin`], [`Pin::into_inner`] should be used
1376-
/// instead.
1377-
#[inline(always)]
1378-
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1379-
#[stable(feature = "pin_into_inner", since = "1.39.0")]
1380-
pub const unsafe fn into_inner_unchecked(pin: Pin<Ptr>) -> Ptr {
1381-
pin.__pointer
1382-
}
1383-
13841359
/// Gets a shared reference to the pinned value this [`Pin`] points to.
13851360
///
13861361
/// This is a generic method to go from `&Pin<Pointer<T>>` to `Pin<&T>`.
@@ -1504,6 +1479,31 @@ impl<Ptr: Deref> Pin<Ptr> {
15041479
{
15051480
*(self.__pointer) = value;
15061481
}
1482+
1483+
/// Unwraps this `Pin<Ptr>`, returning the underlying `Ptr`.
1484+
///
1485+
/// # Safety
1486+
///
1487+
/// This function is unsafe. You must guarantee that you will continue to
1488+
/// treat the pointer `Ptr` as pinned after you call this function, so that
1489+
/// the invariants on the `Pin` type can be upheld. If the code using the
1490+
/// resulting `Ptr` does not continue to maintain the pinning invariants that
1491+
/// is a violation of the API contract and may lead to undefined behavior in
1492+
/// later (safe) operations.
1493+
///
1494+
/// Note that you must be able to guarantee that the data pointed to by `Ptr`
1495+
/// will be treated as pinned all the way until its `drop` handler is complete!
1496+
///
1497+
/// *For more information, see the [`pin` module docs][self]*
1498+
///
1499+
/// If the underlying data is [`Unpin`], [`Pin::into_inner`] should be used
1500+
/// instead.
1501+
#[inline(always)]
1502+
#[rustc_const_unstable(feature = "const_pin", issue = "76654")]
1503+
#[stable(feature = "pin_into_inner", since = "1.39.0")]
1504+
pub const unsafe fn into_inner_unchecked(pin: Pin<Ptr>) -> Ptr {
1505+
pin.__pointer
1506+
}
15071507
}
15081508

15091509
impl<'a, T: ?Sized> Pin<&'a T> {

0 commit comments

Comments
 (0)