Skip to content

Commit d472f8e

Browse files
authored
Rollup merge of #72288 - vorner:stabilize-weak-into-raw, r=dtolnay
Stabilization of weak-into-raw Closes #60728. There are also two removals of `#![feature(weak_into_raw)]` in the `src/tools/miri` submodule. How should I synchronize the changes with there? * I can ignore it for now and once this gets merged, update the tool, send a pull request to that one and then reference the changes to rustc. * I could try submitting the changes to miri first, but then the build would fail there, because the attribute would still be needed. I think the first one is the correct one, extrapolating from the contributing guidelines (even though they speak about breaking the tools and this should not break it, as extra feature should not hurt).
2 parents ea5848d + ba0d0c2 commit d472f8e

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
@@ -580,8 +580,6 @@ impl<T: ?Sized> Rc<T> {
580580
/// # Examples
581581
///
582582
/// ```
583-
/// #![feature(weak_into_raw)]
584-
///
585583
/// use std::rc::Rc;
586584
///
587585
/// let x = Rc::new("hello".to_owned());
@@ -590,7 +588,7 @@ impl<T: ?Sized> Rc<T> {
590588
/// assert_eq!(x_ptr, Rc::as_ptr(&y));
591589
/// assert_eq!(unsafe { &*x_ptr }, "hello");
592590
/// ```
593-
#[unstable(feature = "weak_into_raw", issue = "60728")]
591+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
594592
pub fn as_ptr(this: &Self) -> *const T {
595593
let ptr: *mut RcBox<T> = NonNull::as_ptr(this.ptr);
596594
let fake_ptr = ptr as *mut T;
@@ -1681,8 +1679,6 @@ impl<T> Weak<T> {
16811679
/// # Examples
16821680
///
16831681
/// ```
1684-
/// #![feature(weak_into_raw)]
1685-
///
16861682
/// use std::rc::Rc;
16871683
/// use std::ptr;
16881684
///
@@ -1700,7 +1696,7 @@ impl<T> Weak<T> {
17001696
/// ```
17011697
///
17021698
/// [`null`]: ../../std/ptr/fn.null.html
1703-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1699+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
17041700
pub fn as_ptr(&self) -> *const T {
17051701
let offset = data_offset_sized::<T>();
17061702
let ptr = self.ptr.cast::<u8>().as_ptr().wrapping_offset(offset);
@@ -1718,8 +1714,6 @@ impl<T> Weak<T> {
17181714
/// # Examples
17191715
///
17201716
/// ```
1721-
/// #![feature(weak_into_raw)]
1722-
///
17231717
/// use std::rc::{Rc, Weak};
17241718
///
17251719
/// let strong = Rc::new("hello".to_owned());
@@ -1735,7 +1729,7 @@ impl<T> Weak<T> {
17351729
///
17361730
/// [`from_raw`]: struct.Weak.html#method.from_raw
17371731
/// [`as_ptr`]: struct.Weak.html#method.as_ptr
1738-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1732+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
17391733
pub fn into_raw(self) -> *const T {
17401734
let result = self.as_ptr();
17411735
mem::forget(self);
@@ -1762,8 +1756,6 @@ impl<T> Weak<T> {
17621756
/// # Examples
17631757
///
17641758
/// ```
1765-
/// #![feature(weak_into_raw)]
1766-
///
17671759
/// use std::rc::{Rc, Weak};
17681760
///
17691761
/// let strong = Rc::new("hello".to_owned());
@@ -1788,7 +1780,7 @@ impl<T> Weak<T> {
17881780
/// [`Weak`]: struct.Weak.html
17891781
/// [`new`]: struct.Weak.html#method.new
17901782
/// [`forget`]: ../../std/mem/fn.forget.html
1791-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1783+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
17921784
pub unsafe fn from_raw(ptr: *const T) -> Self {
17931785
if ptr.is_null() {
17941786
Self::new()

src/liballoc/sync.rs

+4-12
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,6 @@ impl<T: ?Sized> Arc<T> {
579579
/// # Examples
580580
///
581581
/// ```
582-
/// #![feature(weak_into_raw)]
583-
///
584582
/// use std::sync::Arc;
585583
///
586584
/// let x = Arc::new("hello".to_owned());
@@ -589,7 +587,7 @@ impl<T: ?Sized> Arc<T> {
589587
/// assert_eq!(x_ptr, Arc::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 ArcInner<T> = NonNull::as_ptr(this.ptr);
595593
let fake_ptr = ptr as *mut T;
@@ -1449,8 +1447,6 @@ impl<T> Weak<T> {
14491447
/// # Examples
14501448
///
14511449
/// ```
1452-
/// #![feature(weak_into_raw)]
1453-
///
14541450
/// use std::sync::Arc;
14551451
/// use std::ptr;
14561452
///
@@ -1468,7 +1464,7 @@ impl<T> Weak<T> {
14681464
/// ```
14691465
///
14701466
/// [`null`]: ../../std/ptr/fn.null.html
1471-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1467+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
14721468
pub fn as_ptr(&self) -> *const T {
14731469
let offset = data_offset_sized::<T>();
14741470
let ptr = self.ptr.cast::<u8>().as_ptr().wrapping_offset(offset);
@@ -1486,8 +1482,6 @@ impl<T> Weak<T> {
14861482
/// # Examples
14871483
///
14881484
/// ```
1489-
/// #![feature(weak_into_raw)]
1490-
///
14911485
/// use std::sync::{Arc, Weak};
14921486
///
14931487
/// let strong = Arc::new("hello".to_owned());
@@ -1503,7 +1497,7 @@ impl<T> Weak<T> {
15031497
///
15041498
/// [`from_raw`]: struct.Weak.html#method.from_raw
15051499
/// [`as_ptr`]: struct.Weak.html#method.as_ptr
1506-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1500+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
15071501
pub fn into_raw(self) -> *const T {
15081502
let result = self.as_ptr();
15091503
mem::forget(self);
@@ -1531,8 +1525,6 @@ impl<T> Weak<T> {
15311525
/// # Examples
15321526
///
15331527
/// ```
1534-
/// #![feature(weak_into_raw)]
1535-
///
15361528
/// use std::sync::{Arc, Weak};
15371529
///
15381530
/// let strong = Arc::new("hello".to_owned());
@@ -1557,7 +1549,7 @@ impl<T> Weak<T> {
15571549
/// [`Weak`]: struct.Weak.html
15581550
/// [`Arc`]: struct.Arc.html
15591551
/// [`forget`]: ../../std/mem/fn.forget.html
1560-
#[unstable(feature = "weak_into_raw", issue = "60728")]
1552+
#[stable(feature = "weak_into_raw", since = "1.45.0")]
15611553
pub unsafe fn from_raw(ptr: *const T) -> Self {
15621554
if ptr.is_null() {
15631555
Self::new()

0 commit comments

Comments
 (0)