Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eb2a2f8

Browse files
committedMar 21, 2025
Allow inlining for Atomic*::from_ptr
Currently this cannot be inlined, which among other things means it can't be used in `compiler-builtins` [1]. These are trivial functions that should be inlineable, so add `#[inline]`. [1]: rust-lang/compiler-builtins#790 (comment)
1 parent a4a11ac commit eb2a2f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎library/core/src/sync/atomic.rs

+3
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ impl AtomicBool {
469469
///
470470
/// [valid]: crate::ptr#safety
471471
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
472+
#[inline]
472473
#[stable(feature = "atomic_from_ptr", since = "1.75.0")]
473474
#[rustc_const_stable(feature = "const_atomic_from_ptr", since = "1.84.0")]
474475
pub const unsafe fn from_ptr<'a>(ptr: *mut bool) -> &'a AtomicBool {
@@ -1389,6 +1390,7 @@ impl<T> AtomicPtr<T> {
13891390
///
13901391
/// [valid]: crate::ptr#safety
13911392
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
1393+
#[inline]
13921394
#[stable(feature = "atomic_from_ptr", since = "1.75.0")]
13931395
#[rustc_const_stable(feature = "const_atomic_from_ptr", since = "1.84.0")]
13941396
pub const unsafe fn from_ptr<'a>(ptr: *mut *mut T) -> &'a AtomicPtr<T> {
@@ -2525,6 +2527,7 @@ macro_rules! atomic_int {
25252527
///
25262528
/// [valid]: crate::ptr#safety
25272529
/// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses
2530+
#[inline]
25282531
#[stable(feature = "atomic_from_ptr", since = "1.75.0")]
25292532
#[rustc_const_stable(feature = "const_atomic_from_ptr", since = "1.84.0")]
25302533
pub const unsafe fn from_ptr<'a>(ptr: *mut $int_type) -> &'a $atomic_type {

0 commit comments

Comments
 (0)
Failed to load comments.