summary refs log tree commit diff
path: root/src/libstd/thread/local.rs
AgeCommit message (Collapse)AuthorLines
2018-04-13std: Minimize size of panicking on wasmAlex Crichton-2/+39
This commit applies a few code size optimizations for the wasm target to the standard library, namely around panics. We notably know that in most configurations it's impossible for us to print anything in wasm32-unknown-unknown so we can skip larger portions of panicking that are otherwise simply informative. This allows us to get quite a nice size reduction. Finally we can also tweak where the allocation happens for the `Box<Any>` that we panic with. By only allocating once unwinding starts we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2018-03-01Fix a bug introduced in previous commitStjepan Glavina-6/+3
2018-02-28Remove thread_local_stateStjepan Glavina-104/+7
2018-02-28Stabilize LocalKey::try_withStjepan Glavina-13/+15
2017-10-26Bump to 1.23 and update bootstrapAlex Crichton-5/+0
This commit updates the bootstrap compiler, bumps the version to 1.23, updates Cargo, updates books, and updates crates.io dependencies
2017-10-17Docs: a LocalKey might start in the Valid stateStjepan Glavina-1/+4
2017-09-07std::thread::LocalKey: Document limitation with initializersJoshua Liebow-Feeser-0/+4
2017-09-04Make the LocalKey facade of thread_local! inlineable cross-crate.Eduard-Mihai Burtescu-3/+13
2017-08-31Update bootstrap compilerAlex Crichton-4/+1
This commit updates the bootstrap compiler and clears out a number of #[cfg(stage0)] annotations and related business
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-2/+2
Like #43008 (f668999), but _much more aggressive_.
2017-08-12Check #[thread_local] statics correctly in the compiler.Eduard-Mihai Burtescu-31/+31
2017-07-25Bump master to 1.21.0Alex Crichton-67/+0
This commit bumps the master branch's version to 1.21.0 and also updates the bootstrap compiler from the freshly minted beta release.
2017-07-15Auto merge of #43185 - durka:thread-local-pub-restricted, r=alexcrichtonbors-1/+57
support pub(restricted) in thread_local! (round 2) Resurrected #40984 now that the issue blocking it was fixed. Original description: `pub(restricted)` was stabilized in #40556 so let's go! Here is a [playground](https://play.rust-lang.org/?gist=f55f32f164a6ed18c219fec8f8293b98&version=nightly&backtrace=1). I changed the interface of `__thread_local_inner!`, which is supposedly unstable but this is not checked for macros (#34097 cc @petrochenkov @jseyfried), so this may be an issue.
2017-07-12Use try_with for with implementationLee Bousfield-9/+2
2017-07-11stage0 fallbackAlex Burka-0/+67
2017-07-11use :vis in thread_local!Alex Burka-30/+8
2017-07-11support pub(restricted) in thread_local!Alex Burka-32/+43
2017-07-10Add LocalKey::try_with as an alternative to stateLee Bousfield-0/+52
2017-06-23rustc: Enable #[thread_local] for WindowsAlex Crichton-3/+79
I think LLVM has had support for quite some time now for this, we just never got around to testing it out and binding it. We've had some trouble landing this in the past I believe, but it's time to try again! This commit flags the `#[thread_local]` attribute as being available for Windows targets and adds an implementation of `register_dtor` in the `thread::local` module to ensure we can destroy these keys. The same functionality is implemented in clang via a function called `__tlregdtor` (presumably provided in some Windows runtime somewhere), but this function unfortunately does not take a data pointer (just a thunk) which means we can't easily call it. For now destructors are just run in the same way the Linux fallback is implemented, which is just keeping track via a single OS-based TLS key.
2017-05-15Add links to the `thread::LocalKey` doc.Felix Raimundo-15/+30
Part of #29378 .
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-3/+3
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-02-15Fix wording in LocalKey documentationStjepan Glavina-2/+2
2017-01-29Fix a few impl stability attributesOliver Middleton-2/+1
The versions show up in rustdoc.
2016-12-18Implement `fmt::Debug` for all structures in libstd.Corey Farwell-1/+17
Part of https://github.com/rust-lang/rust/issues/31869. Also turn on the `missing_debug_implementations` lint at the crate level.
2016-11-01std: Move elf TLS to sys::fast_thread_localBrian Anderson-161/+2
2016-10-22Add Fuchsia supportRaph Levien-30/+42
Adds support for the x86_64-unknown-fuchsia target, which covers the Fuchsia operating system.
2016-09-30Ignore various entire test modules on emscriptenBrian Anderson-7/+1
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+6
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-7/+0
2016-06-22upgrade thread_local! invocation syntaxAlex Burka-4/+38
Allows declaring multiple statics in one macro invocation, and supports attaching attributes to the generated items.
2016-04-25libstd: fix typos in thread::LocalKey docsRyman-2/+2
2016-02-04Stop using unsafe code in TLS macro expansion (fixes #30756)Manish Goregaokar-23/+27
2016-01-29std: Ignore dtors_in_dtors_in_dtors on OSXAlex Crichton-0/+25
This test has been deadlocking and causing problems on the bots basically since its inception. Some memory safety issues were fixed in 987dc84b, but the deadlocks remained afterwards unfortunately. After some investigation, I've concluded that this is just a situation where OSX is not guaranteed to run destructors. The fix in 987dc84b observed that OSX was rewriting the backing TLS memory to its initial state during destruction while we weren't looking, and this would have the effect of canceling the destructors of any other initialized TLS slots. While very difficult to pin down, this is basically what I assume is happening here, so there doesn't seem to really be anythig we can do to ensure the test robustly passes on OSX, so just ignore it for now.
2015-12-21std: Use cfg(target_thread_local) in thread_local!Alex Crichton-76/+44
This transitions the standard library's `thread_local!` macro to use the freshly-added and gated `#[cfg(target_thread_local)]` attribute. This greatly simplifies the `#[cfg]` logic in play here, but requires that the standard library expose both the OS and ELF TLS implementation modules as unstable implementation details. The implementation details were shuffled around a bit but end up generally compiling to the same thing. Closes #26581 (this supersedes the need for the option) Closes #27057 (this also starts ignoring the option)
2015-12-08std: Use mem::replace in TLS initializationAlex Crichton-1/+16
Due to #30228 it's not currently sound to do `*ptr = Some(value)`, so instead use `mem::replace` which fixes the soundness hole for now.
2015-10-30don't use drop_in_place as an intrinsicAlexis Beingessner-1/+1
2015-08-15std: Add issues to all unstable featuresAlex Crichton-5/+9
2015-08-12Fallout in libs -- misc missing bounds uncovered by WF checks.Niko Matsakis-1/+1
2015-08-11Register new snapshotsAlex Crichton-6/+0
* Lots of core prelude imports removed * Makefile support for MSVC env vars and Rust crates removed * Makefile support for morestack removed
2015-08-04syntax: Don't assume `std` exists for testsAlex Crichton-0/+1
This commit removes the injection of `std::env::args()` from `--test` expanded code, relying on the test runner itself to call this funciton. This is more hygienic because we can't assume that `std` exists at the top layer all the time, and it meaks the injected test module entirely self contained.
2015-08-03syntax: Implement #![no_core]Alex Crichton-0/+2
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-07-29std: Remove the curious inner moduleAlex Crichton-8/+8
This isn't actually necessary any more with the advent of `$crate` and changes in the compiler to expand macros to `::core::$foo` in the context of a `#![no_std]` crate. The libcore inner module was also trimmed down a bit to the bare bones.
2015-07-23Rewrite the improper_ctypes lint.Eli Friedman-2/+2
Makes the lint a bit more accurate, and improves the quality of the diagnostic messages by explicitly returning an error message. The new lint is also a little more aggressive: specifically, it now rejects tuples, and it recurses into function pointers.
2015-07-12std: Fix a TLS destructor bug on OSXAlex Crichton-2/+19
TLS tests have been deadlocking on the OSX bots for quite some time now and this commit is the result of the investigation into what's going on. It turns out that a value in TLS which is being destroyed (e.g. the destructor is run) can be reset back to the initial state **while the destructor is running** if TLS is re-accessed. To fix this we stop calling drop_in_place on OSX and instead move the data to a temporary location on the stack.
2015-06-18Fix libstd testsAlex Crichton-2/+1
2015-06-17More test fixes and fallout of stability changesAlex Crichton-2/+1
2015-06-17std: Split the `std_misc` featureAlex Crichton-2/+2
2015-06-11Conver reborrows to .iter() calls where appropriateJoshua Landau-1/+1
2015-05-28std: Add an option to disable ELF based TLSAlex Crichton-24/+54
This commit adds a ./configure option called `--disable-elf-tls` which disables ELF based TLS (that which is communicated to LLVM) on platforms which already support it. OSX 10.6 does not support this form of TLS, and some users of Rust need to target 10.6 and are unable to do so due to the usage of TLS. The standard library will continue to use ELF based TLS on OSX by default (as the officially supported platform is 10.7+), but this adds an option to compile the standard library in a way that is compatible with 10.6.
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-159/+87