Add more from the std

This commit is contained in:
2026-03-20 10:52:13 +01:00
parent 77c8be4748
commit 268a718f1b
91 changed files with 0 additions and 636 deletions

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/backtrace

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/backtrace.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/env.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/error.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/fs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/fs.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/hash

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/keyword_docs.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/macros.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/num

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/raw/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/os/raw/tests.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/prelude

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/process.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/random.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs

View File

@@ -1,60 +0,0 @@
//! Platform-dependent command line arguments abstraction.
#![forbid(unsafe_op_in_unsafe_fn)]
#[cfg(any(
all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))),
target_family = "windows",
target_os = "hermit",
target_os = "motor",
target_os = "uefi",
target_os = "wasi",
target_os = "xous",
))]
mod common;
cfg_select! {
any(
all(target_family = "unix", not(any(target_os = "espidf", target_os = "vita"))),
target_os = "hermit",
) => {
mod unix;
pub use unix::*;
}
target_family = "windows" => {
mod windows;
pub use windows::*;
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod sgx;
pub use sgx::*;
}
target_os = "motor" => {
mod motor;
pub use motor::*;
}
target_os = "uefi" => {
mod uefi;
pub use uefi::*;
}
all(target_os = "wasi", target_env = "p1") => {
mod wasip1;
pub use wasip1::*;
}
all(target_os = "wasi", any(target_env = "p2", target_env = "p3")) => {
mod wasip2;
pub use wasip2::*;
}
target_os = "xous" => {
mod xous;
pub use xous::*;
}
target_os = "zkvm" => {
mod zkvm;
pub use zkvm::*;
}
_ => {
mod unsupported;
pub use unsupported::*;
}
}

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/args/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/cmath.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/configure_builtins.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/env/common.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/env/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/env/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/env_consts.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/exit.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/fd/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/fs/common.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/fs/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/fs/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/helpers/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/helpers/small_c_string.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/helpers/tests.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/helpers/wstr.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/io/error/generic.rs

View File

@@ -1,56 +0,0 @@
cfg_select! {
target_os = "hermit" => {
mod hermit;
pub use hermit::*;
}
target_os = "motor" => {
mod motor;
pub use motor::*;
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod sgx;
pub use sgx::*;
}
target_os = "solid_asp3" => {
mod solid;
pub use solid::*;
}
target_os = "teeos" => {
mod teeos;
pub use teeos::*;
}
target_os = "uefi" => {
mod uefi;
pub use uefi::*;
}
target_family = "unix" => {
mod unix;
pub use unix::*;
}
target_os = "wasi" => {
mod wasi;
pub use wasi::*;
}
target_os = "windows" => {
mod windows;
pub use windows::*;
}
target_os = "xous" => {
mod xous;
pub use xous::*;
}
any(
target_os = "vexos",
target_family = "wasm",
target_os = "zkvm",
target_os = "survos",
) => {
mod generic;
pub use generic::*;
}
}
pub type RawOsError = cfg_select! {
target_os = "uefi" => usize,
_ => i32,
};

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/io/io_slice/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/io/is_terminal/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/io/kernel_copy/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/io/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/net/connection/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/net/connection/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/net/hostname/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/net/hostname/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/net/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/os_str/bytes.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/os_str/bytes/tests.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/os_str/mod.rs

View File

@@ -1,73 +0,0 @@
//! The PAL (platform abstraction layer) contains platform-specific abstractions
//! for implementing the features in the other submodules, such as e.g. bindings.
#![allow(missing_debug_implementations)]
cfg_select! {
unix => {
mod unix;
pub use self::unix::*;
}
windows => {
mod windows;
pub use self::windows::*;
}
target_os = "solid_asp3" => {
mod solid;
pub use self::solid::*;
}
target_os = "hermit" => {
mod hermit;
pub use self::hermit::*;
}
target_os = "motor" => {
mod motor;
pub use self::motor::*;
}
target_os = "trusty" => {
mod trusty;
pub use self::trusty::*;
}
target_os = "vexos" => {
mod vexos;
pub use self::vexos::*;
}
target_os = "wasi" => {
mod wasi;
pub use self::wasi::*;
}
target_family = "wasm" => {
mod wasm;
pub use self::wasm::*;
}
target_os = "xous" => {
mod xous;
pub use self::xous::*;
}
target_os = "uefi" => {
mod uefi;
pub use self::uefi::*;
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod sgx;
pub use self::sgx::*;
}
target_os = "teeos" => {
mod teeos;
pub use self::teeos::*;
}
target_os = "zkvm" => {
mod zkvm;
pub use self::zkvm::*;
}
target_os = "survos" => {
mod unsupported;
pub use self::unsupported::*;
mod survos;
pub use self::survos::*;
}
_ => {
mod unsupported;
pub use self::unsupported::*;
}
}

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unsupported/common.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unsupported/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unsupported/os.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/path/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/path/unix.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/personality/dwarf/eh.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/personality/dwarf/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/personality/dwarf/tests.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/personality/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pipe/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pipe/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/platform_version/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/process/env.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/process/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/process/unsupported.rs

View File

@@ -1,134 +0,0 @@
cfg_select! {
// Tier 1
any(target_os = "linux", target_os = "android") => {
mod linux;
pub use linux::{fill_bytes, hashmap_random_keys};
}
target_os = "windows" => {
mod windows;
pub use windows::fill_bytes;
}
target_vendor = "apple" => {
mod apple;
pub use apple::fill_bytes;
// Others, in alphabetical ordering.
}
any(
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "rtems",
target_os = "solaris",
target_os = "vita",
target_os = "nuttx",
) => {
mod arc4random;
pub use arc4random::fill_bytes;
}
target_os = "emscripten" => {
mod getentropy;
pub use getentropy::fill_bytes;
}
target_os = "espidf" => {
mod espidf;
pub use espidf::fill_bytes;
}
target_os = "fuchsia" => {
mod fuchsia;
pub use fuchsia::fill_bytes;
}
target_os = "hermit" => {
mod hermit;
pub use hermit::fill_bytes;
}
any(target_os = "horizon", target_os = "cygwin") => {
// FIXME(horizon): add arc4random_buf to shim-3ds
mod getrandom;
pub use getrandom::fill_bytes;
}
any(
target_os = "aix",
target_os = "hurd",
target_os = "l4re",
target_os = "nto",
) => {
mod unix_legacy;
pub use unix_legacy::fill_bytes;
}
target_os = "redox" => {
mod redox;
pub use redox::fill_bytes;
}
target_os = "motor" => {
mod motor;
pub use motor::fill_bytes;
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod sgx;
pub use sgx::fill_bytes;
}
target_os = "solid_asp3" => {
mod solid;
pub use solid::fill_bytes;
}
target_os = "teeos" => {
mod teeos;
pub use teeos::fill_bytes;
}
target_os = "trusty" => {
mod trusty;
pub use trusty::fill_bytes;
}
target_os = "uefi" => {
mod uefi;
pub use uefi::fill_bytes;
}
target_os = "vxworks" => {
mod vxworks;
pub use vxworks::fill_bytes;
}
all(target_os = "wasi", target_env = "p1") => {
mod wasip1;
pub use wasip1::fill_bytes;
}
all(target_os = "wasi", any(target_env = "p2", target_env = "p3")) => {
mod wasip2;
pub use wasip2::{fill_bytes, hashmap_random_keys};
}
target_os = "zkvm" => {
mod zkvm;
pub use zkvm::fill_bytes;
}
any(
all(target_family = "wasm", target_os = "unknown"),
target_os = "xous",
target_os = "vexos",
target_os = "survos",
) => {
// FIXME: finally remove std support for wasm32-unknown-unknown
// FIXME: add random data generation to xous
mod unsupported;
pub use unsupported::{fill_bytes, hashmap_random_keys};
}
_ => {}
}
#[cfg(not(any(
target_os = "linux",
target_os = "android",
all(target_family = "wasm", target_os = "unknown"),
all(target_os = "wasi", not(target_env = "p1")),
target_os = "xous",
target_os = "vexos",
target_os = "survos",
)))]
pub fn hashmap_random_keys() -> (u64, u64) {
let mut buf = [0; 16];
fill_bytes(&mut buf);
let k1 = u64::from_ne_bytes(buf[..8].try_into().unwrap());
let k2 = u64::from_ne_bytes(buf[8..].try_into().unwrap());
(k1, k2)
}

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/random/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/stdio/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/stdio/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/condvar/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/condvar/no_threads.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/mutex/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/mutex/no_threads.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/once/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/once/no_threads.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/once_box.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/rwlock/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/rwlock/no_threads.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/thread_parking/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/sync/thread_parking/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/thread/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/thread/unsupported.rs

View File

@@ -1,227 +0,0 @@
//! Implementation of the `thread_local` macro.
//!
//! There are three different thread-local implementations:
//! * Some targets lack threading support, and hence have only one thread, so
//! the TLS data is stored in a normal `static`.
//! * Some targets support TLS natively via the dynamic linker and C runtime.
//! * On some targets, the OS provides a library-based TLS implementation. The
//! TLS data is heap-allocated and referenced using a TLS key.
//!
//! Each implementation provides a macro which generates the `LocalKey` `const`
//! used to reference the TLS variable, along with the necessary helper structs
//! to track the initialization/destruction state of the variable.
//!
//! Additionally, this module contains abstractions for the OS interfaces used
//! for these implementations.
#![cfg_attr(test, allow(unused))]
#![doc(hidden)]
#![forbid(unsafe_op_in_unsafe_fn)]
#![unstable(
feature = "thread_local_internals",
reason = "internal details of the thread_local macro",
issue = "none"
)]
cfg_select! {
any(
all(target_family = "wasm", not(target_feature = "atomics")),
target_os = "uefi",
target_os = "zkvm",
target_os = "trusty",
target_os = "vexos",
target_os = "survos",
) => {
mod no_threads;
pub use no_threads::{EagerStorage, LazyStorage, thread_local_inner};
pub(crate) use no_threads::{LocalPointer, local_pointer};
}
target_thread_local => {
mod native;
pub use native::{EagerStorage, LazyStorage, thread_local_inner};
pub(crate) use native::{LocalPointer, local_pointer};
}
_ => {
mod os;
pub use os::{Storage, thread_local_inner, value_align};
pub(crate) use os::{LocalPointer, local_pointer};
}
}
/// The native TLS implementation needs a way to register destructors for its data.
/// This module contains platform-specific implementations of that register.
///
/// It turns out however that most platforms don't have a way to register a
/// destructor for each variable. On these platforms, we keep track of the
/// destructors ourselves and register (through the [`guard`] module) only a
/// single callback that runs all of the destructors in the list.
#[cfg(all(target_thread_local, not(all(target_family = "wasm", not(target_feature = "atomics")))))]
pub(crate) mod destructors {
cfg_select! {
any(
target_os = "linux",
target_os = "android",
target_os = "fuchsia",
target_os = "redox",
target_os = "hurd",
target_os = "netbsd",
target_os = "dragonfly"
) => {
mod linux_like;
mod list;
pub(super) use linux_like::register;
pub(super) use list::run;
}
_ => {
mod list;
pub(super) use list::register;
pub(crate) use list::run;
}
}
}
/// This module provides a way to schedule the execution of the destructor list
/// and the [runtime cleanup](crate::rt::thread_cleanup) function. Calling `enable`
/// should ensure that these functions are called at the right times.
pub(crate) mod guard {
cfg_select! {
all(target_thread_local, target_vendor = "apple") => {
mod apple;
pub(crate) use apple::enable;
}
target_os = "windows" => {
mod windows;
pub(crate) use windows::enable;
}
any(
all(target_family = "wasm", not(
all(target_os = "wasi", target_env = "p1", target_feature = "atomics")
)),
target_os = "uefi",
target_os = "zkvm",
target_os = "trusty",
target_os = "vexos",
) => {
pub(crate) fn enable() {
// FIXME: Right now there is no concept of "thread exit" on
// wasm, but this is likely going to show up at some point in
// the form of an exported symbol that the wasm runtime is going
// to be expected to call. For now we just leak everything, but
// if such a function starts to exist it will probably need to
// iterate the destructor list with these functions:
#[cfg(all(target_family = "wasm", target_feature = "atomics"))]
#[allow(unused)]
use super::destructors::run;
#[allow(unused)]
use crate::rt::thread_cleanup;
}
}
any(
target_os = "hermit",
target_os = "xous",
) => {
// `std` is the only runtime, so it just calls the destructor functions
// itself when the time comes.
pub(crate) fn enable() {}
}
target_os = "solid_asp3" => {
mod solid;
pub(crate) use solid::enable;
}
target_os = "survos" => {
// todo
pub(crate) fn enable() {}
}
_ => {
mod key;
pub(crate) use key::enable;
}
}
}
/// `const`-creatable TLS keys.
///
/// Most OSs without native TLS will provide a library-based way to create TLS
/// storage. For each TLS variable, we create a key, which can then be used to
/// reference an entry in a thread-local table. This then associates each key
/// with a pointer which we can get and set to store our data.
pub(crate) mod key {
cfg_select! {
any(
all(
not(target_vendor = "apple"),
not(target_family = "wasm"),
target_family = "unix",
),
all(not(target_thread_local), target_vendor = "apple"),
target_os = "teeos",
all(target_os = "wasi", target_env = "p1", target_feature = "atomics"),
) => {
mod racy;
mod unix;
#[cfg(test)]
mod tests;
pub(super) use racy::LazyKey;
pub(super) use unix::{Key, set};
#[cfg(any(not(target_thread_local), test))]
pub(super) use unix::get;
use unix::{create, destroy};
}
all(not(target_thread_local), target_os = "windows") => {
#[cfg(test)]
mod tests;
mod windows;
pub(super) use windows::{Key, LazyKey, get, run_dtors, set};
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod racy;
mod sgx;
#[cfg(test)]
mod tests;
pub(super) use racy::LazyKey;
pub(super) use sgx::{Key, get, set};
use sgx::{create, destroy};
}
target_os = "xous" => {
mod racy;
#[cfg(test)]
mod tests;
mod xous;
pub(super) use racy::LazyKey;
pub(crate) use xous::destroy_tls;
pub(super) use xous::{Key, get, set};
use xous::{create, destroy};
}
target_os = "motor" => {
mod racy;
#[cfg(test)]
mod tests;
pub(super) use racy::LazyKey;
pub(super) use moto_rt::tls::{Key, get, set};
use moto_rt::tls::{create, destroy};
}
_ => {}
}
}
/// Run a callback in a scenario which must not unwind (such as a `extern "C"
/// fn` declared in a user crate). If the callback unwinds anyway, then
/// `rtabort` with a message about thread local panicking on drop.
#[inline]
#[allow(dead_code)]
fn abort_on_dtor_unwind(f: impl FnOnce()) {
// Using a guard like this is lower cost.
let guard = DtorUnwindGuard;
f();
core::mem::forget(guard);
struct DtorUnwindGuard;
impl Drop for DtorUnwindGuard {
#[inline]
fn drop(&mut self) {
// This is not terribly descriptive, but it doesn't need to be as we'll
// already have printed a panic message at this point.
rtabort!("thread local panicked on drop");
}
}
}

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/thread_local/no_threads.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/thread_local/os.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/time/mod.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/time/unsupported.rs

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread

View File

@@ -1 +0,0 @@
/home/julien/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/time.rs