Skip to content

Commit ba0d0c2

Browse files
committed
Stabilization of weak-into-raw
Stabilizes rust-lang#60728.
1 parent 6163394 commit ba0d0c2

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

src/liballoc/rc.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,6 @@ impl<T: ?Sized> Rc<T> {
579579
/// # Examples
580580
///
581581
/// ```
582-
/// #![feature(weak_into_raw)]
583-
///
584582
/// use std::rc::Rc;
585583
///
586584
/// let x = Rc::new("hello".to_owned());
@@ -589,7 +587,7 @@ impl<T: ?Sized> Rc<T> {
589587
/// assert_eq!(x_ptr, Rc::as_ptr(&y));
590588
/// assert_eq!(unsafe { &*x_ptr }, "hello");
591589
/// ```
592-
#[unstable(feature = "weak_into_raw", issue = "60728")]
590+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
593591
pub fn as_ptr(this: &Self) -> *const T {
594592
let ptr: *mut RcBox<T> = NonNull::as_ptr(this.ptr);
595593
let fake_ptr = ptr as *mut T;
@@ -1665,8 +1663,6 @@ impl<T> Weak<T> {
16651663
/// # Examples
16661664
///
16671665
/// ```
1668-
/// #![feature(weak_into_raw)]
1669-
///
16701666
/// use std::rc::Rc;
16711667
/// use std::ptr;
16721668
///
@@ -1684,7 +1680,7 @@ impl<T> Weak<T> {
16841680
/// ```
16851681
///
16861682
/// [`null`]: ../../std/ptr/fn.null.html
1687-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1683+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
16881684
pub fn as_ptr(&self) -> *const T {
16891685
let offset = data_offset_sized::<T>();
16901686
let ptr = self.ptr.cast::<u8>().as_ptr().wrapping_offset(offset);
@@ -1702,8 +1698,6 @@ impl<T> Weak<T> {
17021698
/// # Examples
17031699
///
17041700
/// ```
1705-
/// #![feature(weak_into_raw)]
1706-
///
17071701
/// use std::rc::{Rc, Weak};
17081702
///
17091703
/// let strong = Rc::new("hello".to_owned());
@@ -1719,7 +1713,7 @@ impl<T> Weak<T> {
17191713
///
17201714
/// [`from_raw`]: struct.Weak.html#method.from_raw
17211715
/// [`as_ptr`]: struct.Weak.html#method.as_ptr
1722-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1716+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
17231717
pub fn into_raw(self) -> *const T {
17241718
let result = self.as_ptr();
17251719
mem::forget(self);
@@ -1746,8 +1740,6 @@ impl<T> Weak<T> {
17461740
/// # Examples
17471741
///
17481742
/// ```
1749-
/// #![feature(weak_into_raw)]
1750-
///
17511743
/// use std::rc::{Rc, Weak};
17521744
///
17531745
/// let strong = Rc::new("hello".to_owned());
@@ -1772,7 +1764,7 @@ impl<T> Weak<T> {
17721764
/// [`Weak`]: struct.Weak.html
17731765
/// [`new`]: struct.Weak.html#method.new
17741766
/// [`forget`]: ../../std/mem/fn.forget.html
1775-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1767+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
17761768
pub unsafe fn from_raw(ptr: *const T) -> Self {
17771769
if ptr.is_null() {
17781770
Self::new()

src/liballoc/sync.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,6 @@ impl<T: ?Sized> Arc<T> {
578578
/// # Examples
579579
///
580580
/// ```
581-
/// #![feature(weak_into_raw)]
582-
///
583581
/// use std::sync::Arc;
584582
///
585583
/// let x = Arc::new("hello".to_owned());
@@ -588,7 +586,7 @@ impl<T: ?Sized> Arc<T> {
588586
/// assert_eq!(x_ptr, Arc::as_ptr(&y));
589587
/// assert_eq!(unsafe { &*x_ptr }, "hello");
590588
/// ```
591-
#[unstable(feature = "weak_into_raw", issue = "60728")]
589+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
592590
pub fn as_ptr(this: &Self) -> *const T {
593591
let ptr: *mut ArcInner<T> = NonNull::as_ptr(this.ptr);
594592
let fake_ptr = ptr as *mut T;
@@ -1446,8 +1444,6 @@ impl<T> Weak<T> {
14461444
/// # Examples
14471445
///
14481446
/// ```
1449-
/// #![feature(weak_into_raw)]
1450-
///
14511447
/// use std::sync::Arc;
14521448
/// use std::ptr;
14531449
///
@@ -1465,7 +1461,7 @@ impl<T> Weak<T> {
14651461
/// ```
14661462
///
14671463
/// [`null`]: ../../std/ptr/fn.null.html
1468-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1464+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
14691465
pub fn as_ptr(&self) -> *const T {
14701466
let offset = data_offset_sized::<T>();
14711467
let ptr = self.ptr.cast::<u8>().as_ptr().wrapping_offset(offset);
@@ -1483,8 +1479,6 @@ impl<T> Weak<T> {
14831479
/// # Examples
14841480
///
14851481
/// ```
1486-
/// #![feature(weak_into_raw)]
1487-
///
14881482
/// use std::sync::{Arc, Weak};
14891483
///
14901484
/// let strong = Arc::new("hello".to_owned());
@@ -1500,7 +1494,7 @@ impl<T> Weak<T> {
15001494
///
15011495
/// [`from_raw`]: struct.Weak.html#method.from_raw
15021496
/// [`as_ptr`]: struct.Weak.html#method.as_ptr
1503-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1497+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
15041498
pub fn into_raw(self) -> *const T {
15051499
let result = self.as_ptr();
15061500
mem::forget(self);
@@ -1528,8 +1522,6 @@ impl<T> Weak<T> {
15281522
/// # Examples
15291523
///
15301524
/// ```
1531-
/// #![feature(weak_into_raw)]
1532-
///
15331525
/// use std::sync::{Arc, Weak};
15341526
///
15351527
/// let strong = Arc::new("hello".to_owned());
@@ -1554,7 +1546,7 @@ impl<T> Weak<T> {
15541546
/// [`Weak`]: struct.Weak.html
15551547
/// [`Arc`]: struct.Arc.html
15561548
/// [`forget`]: ../../std/mem/fn.forget.html
1557-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1549+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
15581550
pub unsafe fn from_raw(ptr: *const T) -> Self {
15591551
if ptr.is_null() {
15601552
Self::new()

0 commit comments

Comments
 (0)