std: clean up the TLS implementation
This commit is contained in:
parent
5f0531da05
commit
0e7e75ebca
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user