diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-03-22 12:00:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-22 12:00:51 +0100 |
| commit | 2644500bff498ddbb2d1237c4ee43af2ef60a084 (patch) | |
| tree | befca986e170c7564a7858ecb83ba7800eb333c3 /library/core/src | |
| parent | 5a9d98d1d3891371265aae9ce4f476ae43e27055 (diff) | |
| parent | eb2a2f86bb7b018afaabb1b42d55086470780bfa (diff) | |
| download | rust-2644500bff498ddbb2d1237c4ee43af2ef60a084.tar.gz rust-2644500bff498ddbb2d1237c4ee43af2ef60a084.zip | |
Rollup merge of #138804 - tgross35:atomic-from-ptr-inline, r=RalfJung
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]: https://github.com/rust-lang/compiler-builtins/pull/790#issuecomment-2744371738
Diffstat (limited to 'library/core/src')
| -rw-r--r-- | library/core/src/sync/atomic.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs index 88bee622031..9b1b13e7129 100644 --- a/library/core/src/sync/atomic.rs +++ b/library/core/src/sync/atomic.rs @@ -469,6 +469,7 @@ impl AtomicBool { /// /// [valid]: crate::ptr#safety /// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses + #[inline] #[stable(feature = "atomic_from_ptr", since = "1.75.0")] #[rustc_const_stable(feature = "const_atomic_from_ptr", since = "1.84.0")] pub const unsafe fn from_ptr<'a>(ptr: *mut bool) -> &'a AtomicBool { @@ -1389,6 +1390,7 @@ impl<T> AtomicPtr<T> { /// /// [valid]: crate::ptr#safety /// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses + #[inline] #[stable(feature = "atomic_from_ptr", since = "1.75.0")] #[rustc_const_stable(feature = "const_atomic_from_ptr", since = "1.84.0")] pub const unsafe fn from_ptr<'a>(ptr: *mut *mut T) -> &'a AtomicPtr<T> { @@ -2525,6 +2527,7 @@ macro_rules! atomic_int { /// /// [valid]: crate::ptr#safety /// [Memory model for atomic accesses]: self#memory-model-for-atomic-accesses + #[inline] #[stable(feature = "atomic_from_ptr", since = "1.75.0")] #[rustc_const_stable(feature = "const_atomic_from_ptr", since = "1.84.0")] pub const unsafe fn from_ptr<'a>(ptr: *mut $int_type) -> &'a $atomic_type { |
