From 7e4758f8f961c316787823f24733689ac35cb0fb Mon Sep 17 00:00:00 2001 From: Nicole LeGare Date: Mon, 9 Nov 2026 14:27:34 -0800 Subject: [PATCH] Disable no_threads compiler errors for Trusty targets --- library/std/src/sys/sync/condvar/no_threads.rs | 3 +++ library/std/src/sys/sync/mutex/no_threads.rs | 3 +++ library/std/src/sys/sync/once/no_threads.rs | 3 +++ library/std/src/sys/sync/rwlock/no_threads.rs | 3 +++ library/std/src/sys/thread_local/no_threads.rs | 3 +++ 5 files changed, 15 insertions(+) diff --git a/library/std/src/sys/sync/condvar/no_threads.rs b/library/std/src/sys/sync/condvar/no_threads.rs index 98ca2288f74a2..ff2046b0edcdf 100644 --- a/library/std/src/sys/sync/condvar/no_threads.rs +++ b/library/std/src/sys/sync/condvar/no_threads.rs @@ -8,6 +8,9 @@ use crate::time::Duration; // the main thread, but they are forbidden from accessing sync primitives (the same as UNIX // signal handlers). not(target_os = "vexos"), + // Trusty is "target_has_threads" because it needs atomics for shared-memory IPC, but processes + // can't spawn threads. + not(target_os = "trusty"), ))] compile_error!("Using no_threads implementation on a target with threads"); diff --git a/library/std/src/sys/sync/mutex/no_threads.rs b/library/std/src/sys/sync/mutex/no_threads.rs index d031c0e7e1dcf..6fcbb29cfaaeb 100644 --- a/library/std/src/sys/sync/mutex/no_threads.rs +++ b/library/std/src/sys/sync/mutex/no_threads.rs @@ -6,6 +6,9 @@ use crate::cell::Cell; // the main thread, but they are forbidden from accessing sync primitives (the same as UNIX // signal handlers). not(target_os = "vexos"), + // Trusty is "target_has_threads" because it needs atomics for shared-memory IPC, but processes + // can't spawn threads. + not(target_os = "trusty"), ))] compile_error!("Using no_threads implementation on a target with threads"); diff --git a/library/std/src/sys/sync/once/no_threads.rs b/library/std/src/sys/sync/once/no_threads.rs index 725ec28f7cd4f..c4eb8a775ef6e 100644 --- a/library/std/src/sys/sync/once/no_threads.rs +++ b/library/std/src/sys/sync/once/no_threads.rs @@ -8,6 +8,9 @@ use crate::sync::once::OnceExclusiveState; // the main thread, but they are forbidden from accessing sync primitives (the same as UNIX // signal handlers). not(target_os = "vexos"), + // Trusty is "target_has_threads" because it needs atomics for shared-memory IPC, but processes + // can't spawn threads. + not(target_os = "trusty"), ))] compile_error!("Using no_threads implementation on a target with threads"); diff --git a/library/std/src/sys/sync/rwlock/no_threads.rs b/library/std/src/sys/sync/rwlock/no_threads.rs index e7e845cc785c7..62c893dd56e0e 100644 --- a/library/std/src/sys/sync/rwlock/no_threads.rs +++ b/library/std/src/sys/sync/rwlock/no_threads.rs @@ -6,6 +6,9 @@ use crate::cell::Cell; // the main thread, but they are forbidden from accessing sync primitives (the same as UNIX // signal handlers). not(target_os = "vexos"), + // Trusty is "target_has_threads" because it needs atomics for shared-memory IPC, but processes + // can't spawn threads. + not(target_os = "trusty"), ))] compile_error!("Using no_threads implementation on a target with threads"); diff --git a/library/std/src/sys/thread_local/no_threads.rs b/library/std/src/sys/thread_local/no_threads.rs index c8d40a5f4e5d7..fe77ca61b6f6a 100644 --- a/library/std/src/sys/thread_local/no_threads.rs +++ b/library/std/src/sys/thread_local/no_threads.rs @@ -12,6 +12,9 @@ use crate::ptr; // Since there is only one context that's allowed to access thread locals, it's sound to use the // no_threads implementation. not(target_os = "vexos"), + // Trusty is "target_has_threads" because it needs atomics for shared-memory IPC, but processes + // can't spawn threads. + not(target_os = "trusty"), ))] compile_error!("Using no_threads implementation on a target with threads");