Rollup merge of #125048 - dingxiangfei2009:stable-deref, r=amanieu · patricklam/verify-rust-std@e20aa64 (original) (raw)

`@@ -1715,10 +1715,56 @@ impl<Ptr: fmt::Pointer> fmt::Pointer for Pin {

`

1715

1715

`// for other reasons, though, so we just need to take care not to allow such

`

1716

1716

`// impls to land in std.

`

1717

1717

`#[stable(feature = "pin", since = "1.33.0")]

`

1718

``

`-

impl<Ptr, U> CoerceUnsized<Pin> for Pin where Ptr: CoerceUnsized {}

`

``

1718

`+

impl<Ptr, U> CoerceUnsized<Pin> for Pin

`

``

1719

`+

where

`

``

1720

`+

Ptr: CoerceUnsized + PinCoerceUnsized,

`

``

1721

`+

U: PinCoerceUnsized,

`

``

1722

`+

{

`

``

1723

`+

}

`

``

1724

+

``

1725

`+

#[stable(feature = "pin", since = "1.33.0")]

`

``

1726

`+

impl<Ptr, U> DispatchFromDyn<Pin> for Pin

`

``

1727

`+

where

`

``

1728

`+

Ptr: DispatchFromDyn + PinCoerceUnsized,

`

``

1729

`+

U: PinCoerceUnsized,

`

``

1730

`+

{

`

``

1731

`+

}

`

``

1732

+

``

1733

`+

#[unstable(feature = "pin_coerce_unsized_trait", issue = "123430")]

`

``

1734

`+

/// Trait that indicates that this is a pointer or a wrapper for one, where

`

``

1735

`+

/// unsizing can be performed on the pointee when it is pinned.

`

``

1736

`+

///

`

``

1737

`+

/// # Safety

`

``

1738

`+

///

`

``

1739

`` +

/// If this type implements Deref, then the concrete type returned by deref

``

``

1740

`` +

/// and deref_mut must not change without a modification. The following

``

``

1741

`+

/// operations are not considered modifications:

`

``

1742

`+

///

`

``

1743

`+

/// * Moving the pointer.

`

``

1744

`+

/// * Performing unsizing coercions on the pointer.

`

``

1745

`+

/// * Performing dynamic dispatch with the pointer.

`

``

1746

`` +

/// * Calling deref or deref_mut on the pointer.

``

``

1747

`+

///

`

``

1748

`+

/// The concrete type of a trait object is the type that the vtable corresponds

`

``

1749

`+

/// to. The concrete type of a slice is an array of the same element type and

`

``

1750

`+

/// the length specified in the metadata. The concrete type of a sized type

`

``

1751

`+

/// is the type itself.

`

``

1752

`+

pub unsafe trait PinCoerceUnsized {}

`

``

1753

+

``

1754

`+

#[stable(feature = "pin", since = "1.33.0")]

`

``

1755

`+

unsafe impl<'a, T: ?Sized> PinCoerceUnsized for &'a T {}

`

``

1756

+

``

1757

`+

#[stable(feature = "pin", since = "1.33.0")]

`

``

1758

`+

unsafe impl<'a, T: ?Sized> PinCoerceUnsized for &'a mut T {}

`

``

1759

+

``

1760

`+

#[stable(feature = "pin", since = "1.33.0")]

`

``

1761

`+

unsafe impl<T: PinCoerceUnsized> PinCoerceUnsized for Pin {}

`

``

1762

+

``

1763

`+

#[stable(feature = "pin", since = "1.33.0")]

`

``

1764

`+

unsafe impl<T: ?Sized> PinCoerceUnsized for *const T {}

`

1719

1765

``

1720

1766

`#[stable(feature = "pin", since = "1.33.0")]

`

1721

``

`-

impl<Ptr, U> DispatchFromDyn<Pin> for Pin where Ptr: DispatchFromDyn {}

`

``

1767

`+

unsafe impl<T: ?Sized> PinCoerceUnsized for *mut T {}

`

1722

1768

``

1723

1769

`` /// Constructs a [Pin]<[&mut] T>, by pinning a value: T locally.

``

1724

1770

`///

`