diff options
| author | joboet <jonasboettiger@icloud.com> | 2024-05-24 11:46:09 +0200 |
|---|---|---|
| committer | joboet <jonasboettiger@icloud.com> | 2024-05-24 12:28:05 +0200 |
| commit | 0e7e75ebca2ee9cc9a6c019110797250094908f5 (patch) | |
| tree | 0f3c1fd994f5155fe2ff5fe45e15a8ff65d8163b | |
| parent | 5f0531da05114b473cb04edce0d4374d516b9125 (diff) | |
| download | rust-0e7e75ebca2ee9cc9a6c019110797250094908f5.tar.gz rust-0e7e75ebca2ee9cc9a6c019110797250094908f5.zip | |
std: clean up the TLS implementation
| -rw-r--r-- | library/std/src/sys/mod.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/thread_local/fast_local/lazy.rs | 1 | ||||
| -rw-r--r-- | library/std/src/sys/thread_local/mod.rs | 4 | ||||
| -rw-r--r-- | library/std/src/sys/thread_local/os_local.rs | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/library/std/src/sys/mod.rs b/library/std/src/sys/mod.rs index bbd1d840e92..8f70cefc601 100644 --- a/library/std/src/sys/mod.rs +++ b/library/std/src/sys/mod.rs @@ -9,8 +9,6 @@ pub mod cmath; pub mod os_str; pub mod path; pub mod sync; -#[allow(dead_code)] -#[allow(unused_imports)] pub mod thread_local; // FIXME(117276): remove this, move feature implementations into individual diff --git a/library/std/src/sys/thread_local/fast_local/lazy.rs b/library/std/src/sys/thread_local/fast_local/lazy.rs index 14371768d30..c2e9a171454 100644 --- a/library/std/src/sys/thread_local/fast_local/lazy.rs +++ b/library/std/src/sys/thread_local/fast_local/lazy.rs @@ -1,6 +1,5 @@ use crate::cell::UnsafeCell; use crate::hint::unreachable_unchecked; -use crate::mem::forget; use crate::ptr; use crate::sys::thread_local::abort_on_dtor_unwind; use crate::sys::thread_local_dtor::register_dtor; diff --git a/library/std/src/sys/thread_local/mod.rs b/library/std/src/sys/thread_local/mod.rs index 1acf1f8d8c1..0a78a1a1cf0 100644 --- a/library/std/src/sys/thread_local/mod.rs +++ b/library/std/src/sys/thread_local/mod.rs @@ -1,4 +1,5 @@ #![unstable(feature = "thread_local_internals", reason = "should not be necessary", issue = "none")] +#![cfg_attr(test, allow(unused))] // There are three thread-local implementations: "static", "fast", "OS". // The "OS" thread local key type is accessed via platform-specific API calls and is slow, while the @@ -28,7 +29,8 @@ cfg_if::cfg_if! { /// fn` declared in a user crate). If the callback unwinds anyway, then /// `rtabort` with a message about thread local panicking on drop. #[inline] -pub fn abort_on_dtor_unwind(f: impl FnOnce()) { +#[allow(dead_code)] +fn abort_on_dtor_unwind(f: impl FnOnce()) { // Using a guard like this is lower cost. let guard = DtorUnwindGuard; f(); diff --git a/library/std/src/sys/thread_local/os_local.rs b/library/std/src/sys/thread_local/os_local.rs index 6b24fe254a1..d6ddbb78a9c 100644 --- a/library/std/src/sys/thread_local/os_local.rs +++ b/library/std/src/sys/thread_local/os_local.rs @@ -1,8 +1,8 @@ use super::abort_on_dtor_unwind; use crate::cell::Cell; use crate::marker::PhantomData; +use crate::ptr; use crate::sys_common::thread_local_key::StaticKey as OsKey; -use crate::{panic, ptr}; #[doc(hidden)] #[allow_internal_unstable(thread_local_internals)] |
