From 4b86b1a11a6f34cc6b9a877ba032f9359b6e130f Mon Sep 17 00:00:00 2001 From: joboet Date: Mon, 23 Feb 2026 16:46:54 +0100 Subject: [PATCH] compiler: manually implement `DynSend` for atomic primitives The manual `DynSend` implementation for `AtomicPtr` blocks the auto-implementation for other atomic primitives since they forward to the same `Atomic` type now. This breakage cannot occur in user code as it depends on `DynSend` being a custom auto-trait. --- compiler/rustc_data_structures/src/marker.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_data_structures/src/marker.rs b/compiler/rustc_data_structures/src/marker.rs index 72d5f004194a..e2193a97a0f4 100644 --- a/compiler/rustc_data_structures/src/marker.rs +++ b/compiler/rustc_data_structures/src/marker.rs @@ -59,11 +59,16 @@ macro_rules! already_send { // These structures are already `Send`. already_send!( - [std::backtrace::Backtrace][std::io::Stdout][std::io::Stderr][std::io::Error][std::fs::File][std::panic::Location<'_>] - [rustc_arena::DroplessArena][jobserver_crate::Client][jobserver_crate::HelperThread] - [crate::memmap::Mmap][crate::profiling::SelfProfiler][crate::owned_slice::OwnedSlice] + [std::sync::atomic::AtomicBool][std::sync::atomic::AtomicUsize][std::sync::atomic::AtomicU8] + [std::sync::atomic::AtomicU32][std::backtrace::Backtrace][std::io::Stdout][std::io::Stderr] + [std::io::Error][std::fs::File][std::panic::Location<'_>][rustc_arena::DroplessArena] + [jobserver_crate::Client][jobserver_crate::HelperThread][crate::memmap::Mmap] + [crate::profiling::SelfProfiler][crate::owned_slice::OwnedSlice] ); +#[cfg(target_has_atomic = "64")] +already_send!([std::sync::atomic::AtomicU64]); + macro_rules! impl_dyn_send { ($($($attr: meta)* [$ty: ty where $($generics2: tt)*])*) => { $(unsafe impl<$($generics2)*> DynSend for $ty {})*