Skip to content

Commit

Permalink
std: clean up the TLS implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
joboet committed May 24, 2024
1 parent 5f0531d commit 5a7e50e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions library/std/src/sys/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion library/std/src/sys/thread_local/fast_local/lazy.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 3 additions & 1 deletion library/std/src/sys/thread_local/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![unstable(feature = "thread_local_internals", reason = "should not be necessary", issue = "none")]
#![cfg(not(test))]

// 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
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/thread_local/os_local.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down

0 comments on commit 5a7e50e

Please sign in to comment.