Skip to content

Commit 5378aea

Browse files
author
Yuki Okushi
authored
Rollup merge of rust-lang#103800 - danielhenrymantilla:stabilize-pin-macro, r=dtolnay
Stabilize `::{core,std}::pin::pin!` As discussed [over here](rust-lang#93178 (comment)), 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: rust-lang#93178 (now all this needs is an FCP by the proper team?)
2 parents 4aac9b0 + 0b3061a commit 5378aea

File tree

7 files changed

+5
-13
lines changed

7 files changed

+5
-13
lines changed

Diff for: library/core/src/pin.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,6 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
10261026
/// ### Basic usage
10271027
///
10281028
/// ```rust
1029-
/// #![feature(pin_macro)]
10301029
/// # use core::marker::PhantomPinned as Foo;
10311030
/// use core::pin::{pin, Pin};
10321031
///
@@ -1044,7 +1043,6 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
10441043
/// ### Manually polling a `Future` (without `Unpin` bounds)
10451044
///
10461045
/// ```rust
1047-
/// #![feature(pin_macro)]
10481046
/// use std::{
10491047
/// future::Future,
10501048
/// pin::pin,
@@ -1083,7 +1081,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
10831081
/// ### With `Generator`s
10841082
///
10851083
/// ```rust
1086-
/// #![feature(generators, generator_trait, pin_macro)]
1084+
/// #![feature(generators, generator_trait)]
10871085
/// use core::{
10881086
/// ops::{Generator, GeneratorState},
10891087
/// pin::pin,
@@ -1126,7 +1124,6 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
11261124
/// The following, for instance, fails to compile:
11271125
///
11281126
/// ```rust,compile_fail
1129-
/// #![feature(pin_macro)]
11301127
/// use core::pin::{pin, Pin};
11311128
/// # use core::{marker::PhantomPinned as Foo, mem::drop as stuff};
11321129
///
@@ -1168,7 +1165,7 @@ impl<P, U> DispatchFromDyn<Pin<U>> for Pin<P> where P: DispatchFromDyn<U> {}
11681165
/// constructor.
11691166
///
11701167
/// [`Box::pin`]: ../../std/boxed/struct.Box.html#method.pin
1171-
#[unstable(feature = "pin_macro", issue = "93178")]
1168+
#[stable(feature = "pin_macro", since = "CURRENT_RUSTC_VERSION")]
11721169
#[rustc_macro_transparency = "semitransparent"]
11731170
#[allow_internal_unstable(unsafe_pin_internals)]
11741171
pub macro pin($value:expr $(,)?) {

Diff for: library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
#![feature(is_sorted)]
4949
#![feature(layout_for_ptr)]
5050
#![feature(pattern)]
51-
#![feature(pin_macro)]
5251
#![feature(sort_internals)]
5352
#![feature(slice_take)]
5453
#![feature(slice_from_ptr_range)]

Diff for: src/test/ui/pin-macro/cant_access_internals.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// edition:2018
2-
#![feature(pin_macro)]
32

43
use core::{
54
marker::PhantomPinned,

Diff for: src/test/ui/pin-macro/cant_access_internals.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: use of unstable library feature 'unsafe_pin_internals'
2-
--> $DIR/cant_access_internals.rs:12:15
2+
--> $DIR/cant_access_internals.rs:11:15
33
|
44
LL | mem::take(phantom_pinned.pointer);
55
| ^^^^^^^^^^^^^^^^^^^^^^

Diff for: src/test/ui/pin-macro/lifetime_errors_on_promotion_misusage.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// edition:2018
2-
#![feature(pin_macro)]
32

43
use core::{
54
convert::identity,

Diff for: src/test/ui/pin-macro/lifetime_errors_on_promotion_misusage.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0716]: temporary value dropped while borrowed
2-
--> $DIR/lifetime_errors_on_promotion_misusage.rs:12:35
2+
--> $DIR/lifetime_errors_on_promotion_misusage.rs:11:35
33
|
44
LL | let phantom_pinned = identity(pin!(PhantomPinned));
55
| ^^^^^^^^^^^^^^^^^^^ - temporary value is freed at the end of this statement
@@ -13,7 +13,7 @@ LL | stuff(phantom_pinned)
1313
= note: this error originates in the macro `pin` (in Nightly builds, run with -Z macro-backtrace for more info)
1414

1515
error[E0716]: temporary value dropped while borrowed
16-
--> $DIR/lifetime_errors_on_promotion_misusage.rs:19:30
16+
--> $DIR/lifetime_errors_on_promotion_misusage.rs:18:30
1717
|
1818
LL | let phantom_pinned = {
1919
| -------------- borrow later stored here

Diff for: src/tools/miri/tests/pass/issues/issue-miri-2068.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(pin_macro)]
2-
31
use core::future::Future;
42
use core::pin::Pin;
53
use core::task::{Context, Poll};

0 commit comments

Comments
 (0)