Rollup merge of #103800 - danielhenrymantilla:stabilize-pin-macro, r=dtolnay
Stabilize `::{core,std}::pin::pin!` As discussed [over here](https://github.com/rust-lang/rust/issues/93178#issuecomment-1295843548), it looks like a decent time to stabilize the `pin!` macro. ### Public API ```rust // in module `core::pin` /// API: `fn pin<T>($value: T) -> Pin<&'local mut T>` pub macro pin($value:expr $(,)?) { … } ``` - Tracking issue: #93178 (now all this needs is an FCP by the proper team?)
This commit is contained in:
commit
2e17a5d406
8 changed files with 6 additions and 17 deletions
|
@ -622,9 +622,8 @@ impl<P: Deref> Pin<P> {
|
|||
/// that the closure is pinned.
|
||||
///
|
||||
/// The better alternative is to avoid all that trouble and do the pinning in the outer function
|
||||
/// instead (here using the unstable `pin` macro):
|
||||
/// instead (here using the [`pin!`][crate::pin::pin] macro):
|
||||
/// ```
|
||||
/// #![feature(pin_macro)]
|
||||
/// use std::pin::pin;
|
||||
/// use std::task::Context;
|
||||
/// use std::future::Future;
|
||||
|
@ -1026,7 +1025,6 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
|||
/// ### Basic usage
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(pin_macro)]
|
||||
/// # use core::marker::PhantomPinned as Foo;
|
||||
/// use core::pin::{pin, Pin};
|
||||
///
|
||||
|
@ -1044,7 +1042,6 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
|||
/// ### Manually polling a `Future` (without `Unpin` bounds)
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(pin_macro)]
|
||||
/// use std::{
|
||||
/// future::Future,
|
||||
/// pin::pin,
|
||||
|
@ -1083,7 +1080,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
|||
/// ### With `Generator`s
|
||||
///
|
||||
/// ```rust
|
||||
/// #![feature(generators, generator_trait, pin_macro)]
|
||||
/// #![feature(generators, generator_trait)]
|
||||
/// use core::{
|
||||
/// ops::{Generator, GeneratorState},
|
||||
/// pin::pin,
|
||||
|
@ -1126,7 +1123,6 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
|||
/// The following, for instance, fails to compile:
|
||||
///
|
||||
/// ```rust,compile_fail
|
||||
/// #![feature(pin_macro)]
|
||||
/// use core::pin::{pin, Pin};
|
||||
/// # use core::{marker::PhantomPinned as Foo, mem::drop as stuff};
|
||||
///
|
||||
|
@ -1168,7 +1164,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
|
|||
/// constructor.
|
||||
///
|
||||
/// [`Box::pin`]: ../../std/boxed/struct.Box.html#method.pin
|
||||
#[unstable(feature = "pin_macro", issue = "93178")]
|
||||
#[stable(feature = "pin_macro", since = "CURRENT_RUSTC_VERSION")]
|
||||
#[rustc_macro_transparency = "semitransparent"]
|
||||
#[allow_internal_unstable(unsafe_pin_internals)]
|
||||
pub macro pin($value:expr $(,)?) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue