Skip to content

Commit 0e7e75e

Browse files
committed
std: clean up the TLS implementation
1 parent 5f0531d commit 0e7e75e

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

library/std/src/sys/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ pub mod cmath;
99
pub mod os_str;
1010
pub mod path;
1111
pub mod sync;
12-
#[allow(dead_code)]
13-
#[allow(unused_imports)]
1412
pub mod thread_local;
1513

1614
// FIXME(117276): remove this, move feature implementations into individual

library/std/src/sys/thread_local/fast_local/lazy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::cell::UnsafeCell;
22
use crate::hint::unreachable_unchecked;
3-
use crate::mem::forget;
43
use crate::ptr;
54
use crate::sys::thread_local::abort_on_dtor_unwind;
65
use crate::sys::thread_local_dtor::register_dtor;

library/std/src/sys/thread_local/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![unstable(feature = "thread_local_internals", reason = "should not be necessary", issue = "none")]
2+
#![cfg_attr(test, allow(unused))]
23

34
// There are three thread-local implementations: "static", "fast", "OS".
45
// 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! {
2829
/// fn` declared in a user crate). If the callback unwinds anyway, then
2930
/// `rtabort` with a message about thread local panicking on drop.
3031
#[inline]
31-
pub fn abort_on_dtor_unwind(f: impl FnOnce()) {
32+
#[allow(dead_code)]
33+
fn abort_on_dtor_unwind(f: impl FnOnce()) {
3234
// Using a guard like this is lower cost.
3335
let guard = DtorUnwindGuard;
3436
f();

library/std/src/sys/thread_local/os_local.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use super::abort_on_dtor_unwind;
22
use crate::cell::Cell;
33
use crate::marker::PhantomData;
4+
use crate::ptr;
45
use crate::sys_common::thread_local_key::StaticKey as OsKey;
5-
use crate::{panic, ptr};
66

77
#[doc(hidden)]
88
#[allow_internal_unstable(thread_local_internals)]

0 commit comments

Comments
 (0)