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 https://github.com/rust-lang/rust/pull/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
This commit is contained in:
commit
e670379b57
2 changed files with 7 additions and 7 deletions
|
@ -960,6 +960,7 @@ impl AtomicBool {
|
||||||
/// ```ignore (extern-declaration)
|
/// ```ignore (extern-declaration)
|
||||||
/// # fn main() {
|
/// # fn main() {
|
||||||
/// use std::sync::atomic::AtomicBool;
|
/// use std::sync::atomic::AtomicBool;
|
||||||
|
///
|
||||||
/// extern "C" {
|
/// extern "C" {
|
||||||
/// fn my_atomic_op(arg: *mut bool);
|
/// fn my_atomic_op(arg: *mut bool);
|
||||||
/// }
|
/// }
|
||||||
|
@ -971,7 +972,8 @@ impl AtomicBool {
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")]
|
#[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
#[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub const fn as_ptr(&self) -> *mut bool {
|
pub const fn as_ptr(&self) -> *mut bool {
|
||||||
self.v.get().cast()
|
self.v.get().cast()
|
||||||
}
|
}
|
||||||
|
@ -1890,7 +1892,6 @@ impl<T> AtomicPtr<T> {
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```ignore (extern-declaration)
|
/// ```ignore (extern-declaration)
|
||||||
/// #![feature(atomic_mut_ptr)]
|
|
||||||
/// use std::sync::atomic::AtomicPtr;
|
/// use std::sync::atomic::AtomicPtr;
|
||||||
///
|
///
|
||||||
/// extern "C" {
|
/// extern "C" {
|
||||||
|
@ -1906,7 +1907,8 @@ impl<T> AtomicPtr<T> {
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "atomic_mut_ptr", reason = "recently added", issue = "66893")]
|
#[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
|
||||||
|
#[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
|
||||||
pub const fn as_ptr(&self) -> *mut *mut T {
|
pub const fn as_ptr(&self) -> *mut *mut T {
|
||||||
self.p.get()
|
self.p.get()
|
||||||
}
|
}
|
||||||
|
@ -2859,9 +2861,8 @@ macro_rules! atomic_int {
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "atomic_mut_ptr",
|
#[stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
|
||||||
reason = "recently added",
|
#[rustc_const_stable(feature = "atomic_as_ptr", since = "CURRENT_RUSTC_VERSION")]
|
||||||
issue = "66893")]
|
|
||||||
pub const fn as_ptr(&self) -> *mut $int_type {
|
pub const fn as_ptr(&self) -> *mut $int_type {
|
||||||
self.v.get()
|
self.v.get()
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,6 @@
|
||||||
#![feature(utf8_chunks)]
|
#![feature(utf8_chunks)]
|
||||||
//
|
//
|
||||||
// Library features (core):
|
// Library features (core):
|
||||||
#![feature(atomic_mut_ptr)]
|
|
||||||
#![feature(char_internals)]
|
#![feature(char_internals)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(duration_constants)]
|
#![feature(duration_constants)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue