Skip to content

Commit e670379

Browse files
authored
Rollup merge of #108419 - tgross35:atomic-as-ptr, r=m-ou-se
Stabilize `atomic_as_ptr` Fixes #66893 This stabilizes the `as_ptr` methods for atomics. The stabilization feature gate used here is `atomic_as_ptr` which supersedes `atomic_mut_ptr` to match the change in #107736. This needs FCP. New stable API: ```rust impl AtomicBool { pub const fn as_ptr(&self) -> *mut bool; } impl AtomicI32 { pub const fn as_ptr(&self) -> *mut i32; } // Includes all other atomic types impl<T> AtomicPtr<T> { pub const fn as_ptr(&self) -> *mut *mut T; } ``` r? libs-api ``@rustbot`` label +needs-fcp
2 parents 8efa635 + 318be2b commit e670379

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

library/core/src/sync/atomic.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ impl AtomicBool {
960960
/// ```ignore (extern-declaration)
961961
/// # fn main() {
962962
/// use std::sync::atomic::AtomicBool;
963+
///
963964
/// extern "C" {
964965
/// fn my_atomic_op(arg: *mut bool);
965966
/// }
@@ -971,7 +972,8 @@ impl AtomicBool {
971972
/// # }
972973
/// ```
973974
#[inline]
974-
#[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")]
975+
#[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
976+
#[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
975977
pub const fn as_ptr(&self) -> *mut bool {
976978
self.v.get().cast()
977979
}
@@ -1890,7 +1892,6 @@ impl<T> AtomicPtr<T> {
18901892
/// # Examples
18911893
///
18921894
/// ```ignore (extern-declaration)
1893-
/// #![feature(atomic_mut_ptr)]
18941895
/// use std::sync::atomic::AtomicPtr;
18951896
///
18961897
/// extern "C" {
@@ -1906,7 +1907,8 @@ impl<T> AtomicPtr<T> {
19061907
/// }
19071908
/// ```
19081909
#[inline]
1909-
#[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")]
1910+
#[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
1911+
#[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
19101912
pub const fn as_ptr(&self) -> *mut *mut T {
19111913
self.p.get()
19121914
}
@@ -2859,9 +2861,8 @@ macro_rules! atomic_int {
28592861
/// # }
28602862
/// ```
28612863
#[inline]
2862-
#[unstable(feature = "atomic_mut_ptr",
2863-
reason = "recently added",
2864-
issue = "66893")]
2864+
#[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
2865+
#[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
28652866
pub const fn as_ptr(&self) -> *mut $int_type {
28662867
self.v.get()
28672868
}

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@
274274
#![feature(utf8_chunks)]
275275
//
276276
// Library features (core):
277-
#![feature(atomic_mut_ptr)]
278277
#![feature(char_internals)]
279278
#![feature(core_intrinsics)]
280279
#![feature(duration_constants)]

0 commit comments

Comments
 (0)