Skip to content

Commit 987a5e4

Browse files
committed
Stabilize Pin
1 parent fe91892 commit 987a5e4

File tree

12 files changed

+38
-41
lines changed

12 files changed

+38
-41
lines changed

src/liballoc/boxed.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl<T> Box<T> {
109109
box x
110110
}
111111

112-
#[unstable(feature = "pin", issue = "49150")]
112+
#[stable(feature = "pin", since = "1.33.0")]
113113
#[inline(always)]
114114
pub fn pinned(x: T) -> Pin<Box<T>> {
115115
(box x).into()
@@ -444,7 +444,7 @@ impl<T> From<T> for Box<T> {
444444
}
445445
}
446446

447-
#[unstable(feature = "pin", issue = "49150")]
447+
#[stable(feature = "pin", since = "1.33.0")]
448448
impl<T> From<Box<T>> for Pin<Box<T>> {
449449
fn from(boxed: Box<T>) -> Self {
450450
// It's not possible to move or replace the insides of a `Pin<Box<T>>`
@@ -808,7 +808,7 @@ impl<T: ?Sized> AsMut<T> for Box<T> {
808808
* implementation of `Unpin` (where `T: Unpin`) would be valid/safe, and
809809
* could have a method to project a Pin<T> from it.
810810
*/
811-
#[unstable(feature = "pin", issue = "49150")]
811+
#[stable(feature = "pin", since = "1.33.0")]
812812
impl<T: ?Sized> Unpin for Box<T> { }
813813

814814
#[unstable(feature = "generator_trait", issue = "43122")]

src/liballoc/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@
100100
#![feature(nll)]
101101
#![feature(optin_builtin_traits)]
102102
#![feature(pattern)]
103-
#![feature(pin)]
104103
#![feature(ptr_internals)]
105104
#![feature(ptr_offset_from)]
106105
#![feature(rustc_attrs)]

src/liballoc/rc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ impl<T> Rc<T> {
325325
}
326326
}
327327

328-
#[unstable(feature = "pin", issue = "49150")]
328+
#[stable(feature = "pin", since = "1.33.0")]
329329
pub fn pinned(value: T) -> Pin<Rc<T>> {
330330
unsafe { Pin::new_unchecked(Rc::new(value)) }
331331
}
@@ -1890,5 +1890,5 @@ impl<T: ?Sized> AsRef<T> for Rc<T> {
18901890
}
18911891
}
18921892

1893-
#[unstable(feature = "pin", issue = "49150")]
1893+
#[stable(feature = "pin", since = "1.33.0")]
18941894
impl<T: ?Sized> Unpin for Rc<T> { }

src/liballoc/sync.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<T> Arc<T> {
303303
Arc { ptr: Box::into_raw_non_null(x), phantom: PhantomData }
304304
}
305305

306-
#[unstable(feature = "pin", issue = "49150")]
306+
#[stable(feature = "pin", since = "1.33.0")]
307307
pub fn pinned(data: T) -> Pin<Arc<T>> {
308308
unsafe { Pin::new_unchecked(Arc::new(data)) }
309309
}
@@ -2004,5 +2004,5 @@ impl<T: ?Sized> AsRef<T> for Arc<T> {
20042004
}
20052005
}
20062006

2007-
#[unstable(feature = "pin", issue = "49150")]
2007+
#[stable(feature = "pin", since = "1.33.0")]
20082008
impl<T: ?Sized> Unpin for Arc<T> { }

src/libcore/marker.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -637,23 +637,23 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
637637
/// [`replace`]: ../../std/mem/fn.replace.html
638638
/// [`Pin`]: ../pin/struct.Pin.html
639639
/// [`pin module`]: ../../std/pin/index.html
640-
#[unstable(feature = "pin", issue = "49150")]
640+
#[stable(feature = "pin", since = "1.33.0")]
641641
pub auto trait Unpin {}
642642

643643
/// A marker type which does not implement `Unpin`.
644644
///
645645
/// If a type contains a `PhantomPinned`, it will not implement `Unpin` by default.
646-
#[unstable(feature = "pin", issue = "49150")]
646+
#[stable(feature = "pin", since = "1.33.0")]
647647
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
648648
pub struct PhantomPinned;
649649

650-
#[unstable(feature = "pin", issue = "49150")]
650+
#[stable(feature = "pin", since = "1.33.0")]
651651
impl !Unpin for PhantomPinned {}
652652

653-
#[unstable(feature = "pin", issue = "49150")]
653+
#[stable(feature = "pin", since = "1.33.0")]
654654
impl<'a, T: ?Sized + 'a> Unpin for &'a T {}
655655

656-
#[unstable(feature = "pin", issue = "49150")]
656+
#[stable(feature = "pin", since = "1.33.0")]
657657
impl<'a, T: ?Sized + 'a> Unpin for &'a mut T {}
658658

659659
/// Implementations of `Copy` for primitive types.

src/libcore/option.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl<T> Option<T> {
273273

274274
/// Converts from `Pin<&Option<T>>` to `Option<Pin<&T>>`
275275
#[inline]
276-
#[unstable(feature = "pin", issue = "49150")]
276+
#[stable(feature = "pin", since = "1.33.0")]
277277
pub fn as_pin_ref<'a>(self: Pin<&'a Option<T>>) -> Option<Pin<&'a T>> {
278278
unsafe {
279279
Pin::get_ref(self).as_ref().map(|x| Pin::new_unchecked(x))
@@ -282,7 +282,7 @@ impl<T> Option<T> {
282282

283283
/// Converts from `Pin<&mut Option<T>>` to `Option<Pin<&mut T>>`
284284
#[inline]
285-
#[unstable(feature = "pin", issue = "49150")]
285+
#[stable(feature = "pin", since = "1.33.0")]
286286
pub fn as_pin_mut<'a>(self: Pin<&'a mut Option<T>>) -> Option<Pin<&'a mut T>> {
287287
unsafe {
288288
Pin::get_unchecked_mut(self).as_mut().map(|x| Pin::new_unchecked(x))

src/libcore/pin.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
//! // std::mem::swap(&mut *still_unmoved, &mut *new_unmoved);
9898
//! ```
9999
100-
#![unstable(feature = "pin", issue = "49150")]
100+
#![stable(feature = "pin", since = "1.33.0")]
101101

102102
use fmt;
103103
use marker::{Sized, Unpin};
@@ -116,7 +116,7 @@ use ops::{Deref, DerefMut, CoerceUnsized, DispatchFromDyn};
116116
//
117117
// Note: the derives below are allowed because they all only use `&P`, so they
118118
// cannot move the value behind `pointer`.
119-
#[unstable(feature = "pin", issue = "49150")]
119+
#[stable(feature = "pin", since = "1.33.0")]
120120
#[fundamental]
121121
#[repr(transparent)]
122122
#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
@@ -130,7 +130,7 @@ where
130130
{
131131
/// Construct a new `Pin` around a pointer to some data of a type that
132132
/// implements `Unpin`.
133-
#[unstable(feature = "pin", issue = "49150")]
133+
#[stable(feature = "pin", since = "1.33.0")]
134134
#[inline(always)]
135135
pub fn new(pointer: P) -> Pin<P> {
136136
// Safety: the value pointed to is `Unpin`, and so has no requirements
@@ -152,14 +152,14 @@ impl<P: Deref> Pin<P> {
152152
///
153153
/// If `pointer` dereferences to an `Unpin` type, `Pin::new` should be used
154154
/// instead.
155-
#[unstable(feature = "pin", issue = "49150")]
155+
#[stable(feature = "pin", since = "1.33.0")]
156156
#[inline(always)]
157157
pub unsafe fn new_unchecked(pointer: P) -> Pin<P> {
158158
Pin { pointer }
159159
}
160160

161161
/// Get a pinned shared reference from this pinned pointer.
162-
#[unstable(feature = "pin", issue = "49150")]
162+
#[stable(feature = "pin", since = "1.33.0")]
163163
#[inline(always)]
164164
pub fn as_ref(self: &Pin<P>) -> Pin<&P::Target> {
165165
unsafe { Pin::new_unchecked(&*self.pointer) }
@@ -168,14 +168,14 @@ impl<P: Deref> Pin<P> {
168168

169169
impl<P: DerefMut> Pin<P> {
170170
/// Get a pinned mutable reference from this pinned pointer.
171-
#[unstable(feature = "pin", issue = "49150")]
171+
#[stable(feature = "pin", since = "1.33.0")]
172172
#[inline(always)]
173173
pub fn as_mut(self: &mut Pin<P>) -> Pin<&mut P::Target> {
174174
unsafe { Pin::new_unchecked(&mut *self.pointer) }
175175
}
176176

177177
/// Assign a new value to the memory behind the pinned reference.
178-
#[unstable(feature = "pin", issue = "49150")]
178+
#[stable(feature = "pin", since = "1.33.0")]
179179
#[inline(always)]
180180
pub fn set(mut self: Pin<P>, value: P::Target)
181181
where
@@ -197,7 +197,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
197197
/// will not move so long as the argument value does not move (for example,
198198
/// because it is one of the fields of that value), and also that you do
199199
/// not move out of the argument you receive to the interior function.
200-
#[unstable(feature = "pin", issue = "49150")]
200+
#[stable(feature = "pin", since = "1.33.0")]
201201
pub unsafe fn map_unchecked<U, F>(self: Pin<&'a T>, func: F) -> Pin<&'a U> where
202202
F: FnOnce(&T) -> &U,
203203
{
@@ -213,7 +213,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
213213
/// that lives for as long as the borrow of the `Pin`, not the lifetime of
214214
/// the `Pin` itself. This method allows turning the `Pin` into a reference
215215
/// with the same lifetime as the original `Pin`.
216-
#[unstable(feature = "pin", issue = "49150")]
216+
#[stable(feature = "pin", since = "1.33.0")]
217217
#[inline(always)]
218218
pub fn get_ref(self: Pin<&'a T>) -> &'a T {
219219
self.pointer
@@ -222,7 +222,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
222222

223223
impl<'a, T: ?Sized> Pin<&'a mut T> {
224224
/// Convert this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
225-
#[unstable(feature = "pin", issue = "49150")]
225+
#[stable(feature = "pin", since = "1.33.0")]
226226
#[inline(always)]
227227
pub fn into_ref(self: Pin<&'a mut T>) -> Pin<&'a T> {
228228
Pin { pointer: self.pointer }
@@ -237,7 +237,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
237237
/// that lives for as long as the borrow of the `Pin`, not the lifetime of
238238
/// the `Pin` itself. This method allows turning the `Pin` into a reference
239239
/// with the same lifetime as the original `Pin`.
240-
#[unstable(feature = "pin", issue = "49150")]
240+
#[stable(feature = "pin", since = "1.33.0")]
241241
#[inline(always)]
242242
pub fn get_mut(self: Pin<&'a mut T>) -> &'a mut T
243243
where T: Unpin,
@@ -255,7 +255,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
255255
///
256256
/// If the underlying data is `Unpin`, `Pin::get_mut` should be used
257257
/// instead.
258-
#[unstable(feature = "pin", issue = "49150")]
258+
#[stable(feature = "pin", since = "1.33.0")]
259259
#[inline(always)]
260260
pub unsafe fn get_unchecked_mut(self: Pin<&'a mut T>) -> &'a mut T {
261261
self.pointer
@@ -272,7 +272,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
272272
/// will not move so long as the argument value does not move (for example,
273273
/// because it is one of the fields of that value), and also that you do
274274
/// not move out of the argument you receive to the interior function.
275-
#[unstable(feature = "pin", issue = "49150")]
275+
#[stable(feature = "pin", since = "1.33.0")]
276276
pub unsafe fn map_unchecked_mut<U, F>(self: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where
277277
F: FnOnce(&mut T) -> &mut U,
278278
{
@@ -282,15 +282,15 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
282282
}
283283
}
284284

285-
#[unstable(feature = "pin", issue = "49150")]
285+
#[stable(feature = "pin", since = "1.33.0")]
286286
impl<P: Deref> Deref for Pin<P> {
287287
type Target = P::Target;
288288
fn deref(&self) -> &P::Target {
289289
Pin::get_ref(Pin::as_ref(self))
290290
}
291291
}
292292

293-
#[unstable(feature = "pin", issue = "49150")]
293+
#[stable(feature = "pin", since = "1.33.0")]
294294
impl<P: DerefMut> DerefMut for Pin<P>
295295
where
296296
P::Target: Unpin
@@ -300,21 +300,21 @@ where
300300
}
301301
}
302302

303-
#[unstable(feature = "pin", issue = "49150")]
303+
#[stable(feature = "pin", since = "1.33.0")]
304304
impl<P: fmt::Debug> fmt::Debug for Pin<P> {
305305
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
306306
fmt::Debug::fmt(&self.pointer, f)
307307
}
308308
}
309309

310-
#[unstable(feature = "pin", issue = "49150")]
310+
#[stable(feature = "pin", since = "1.33.0")]
311311
impl<P: fmt::Display> fmt::Display for Pin<P> {
312312
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
313313
fmt::Display::fmt(&self.pointer, f)
314314
}
315315
}
316316

317-
#[unstable(feature = "pin", issue = "49150")]
317+
#[stable(feature = "pin", since = "1.33.0")]
318318
impl<P: fmt::Pointer> fmt::Pointer for Pin<P> {
319319
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
320320
fmt::Pointer::fmt(&self.pointer, f)
@@ -326,13 +326,13 @@ impl<P: fmt::Pointer> fmt::Pointer for Pin<P> {
326326
// `Deref<Target=Unpin>` is unsound. Any such impl would probably be unsound
327327
// for other reasons, though, so we just need to take care not to allow such
328328
// impls to land in std.
329-
#[unstable(feature = "pin", issue = "49150")]
329+
#[stable(feature = "pin", since = "1.33.0")]
330330
impl<P, U> CoerceUnsized<Pin<U>> for Pin<P>
331331
where
332332
P: CoerceUnsized<U>,
333333
{}
334334

335-
#[unstable(feature = "pin", issue = "49150")]
335+
#[stable(feature = "pin", since = "1.33.0")]
336336
impl<'a, P, U> DispatchFromDyn<Pin<U>> for Pin<P>
337337
where
338338
P: DispatchFromDyn<U>,

src/libstd/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@
280280
#![feature(optin_builtin_traits)]
281281
#![feature(panic_internals)]
282282
#![feature(panic_unwind)]
283-
#![feature(pin)]
284283
#![feature(prelude_import)]
285284
#![feature(ptr_internals)]
286285
#![feature(raw)]
@@ -432,7 +431,7 @@ pub use alloc_crate::borrow;
432431
pub use alloc_crate::fmt;
433432
#[stable(feature = "rust1", since = "1.0.0")]
434433
pub use alloc_crate::format;
435-
#[unstable(feature = "pin", issue = "49150")]
434+
#[stable(feature = "pin", since = "1.33.0")]
436435
pub use core::pin;
437436
#[stable(feature = "rust1", since = "1.0.0")]
438437
pub use alloc_crate::slice;

src/test/compile-fail/must_use-in-stdlib-traits.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![deny(unused_must_use)]
2-
#![feature(futures_api, pin, arbitrary_self_types)]
2+
#![feature(arbitrary_self_types, futures_api)]
33

44
use std::iter::Iterator;
55
use std::future::Future;

src/test/run-pass/arbitrary_self_types_stdlib_pointers.rs

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![feature(arbitrary_self_types)]
12-
#![feature(pin)]
1312
#![feature(rustc_attrs)]
1413

1514
use std::{

src/test/run-pass/async-await.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// edition:2018
1212

13-
#![feature(arbitrary_self_types, async_await, await_macro, futures_api, pin)]
13+
#![feature(arbitrary_self_types, async_await, await_macro, futures_api)]
1414

1515
use std::pin::Pin;
1616
use std::future::Future;

src/test/run-pass/futures-api.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(arbitrary_self_types, futures_api, pin)]
11+
#![feature(arbitrary_self_types, futures_api)]
1212
#![allow(unused)]
1313

1414
use std::future::Future;

0 commit comments

Comments
 (0)