rust/src/libstd
Alex Crichton a9c1152c4b std: Add a new top-level thread_local module
This commit removes the `std::local_data` module in favor of a new
`std::thread_local` module providing thread local storage. The module provides
two variants of TLS: one which owns its contents and one which is based on
scoped references. Each implementation has pros and cons listed in the
documentation.

Both flavors have accessors through a function called `with` which yield a
reference to a closure provided. Both flavors also panic if a reference cannot
be yielded and provide a function to test whether an access would panic or not.
This is an implementation of [RFC 461][rfc] and full details can be found in
that RFC.

This is a breaking change due to the removal of the `std::local_data` module.
All users can migrate to the new thread local system like so:

    thread_local!(static FOO: Rc<RefCell<Option<T>>> = Rc::new(RefCell::new(None)))

The old `local_data` module inherently contained the `Rc<RefCell<Option<T>>>` as
an implementation detail which must now be explicitly stated by users.

[rfc]: https://github.com/rust-lang/rfcs/pull/461
[breaking-change]
2014-11-23 23:37:16 -08:00
..
collections std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
io std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
num Fix various deprecation warnings from char changes 2014-11-21 13:18:04 -08:00
path Fallout from deprecation 2014-11-21 14:10:13 -08:00
rand std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
rt unicode: Rename UnicodeChar::is_digit to is_numeric 2014-11-21 13:17:04 -08:00
sync std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
sys std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
thread_local std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
time Rename remaining Failures to Panic 2014-11-20 23:45:42 +05:30
ascii.rs rollup merge of #19194: aturon/stab-ascii 2014-11-23 14:11:51 -05:00
bitflags.rs Repair various cases where values of distinct types were being operated 2014-11-05 09:15:28 -05:00
c_vec.rs Rename remaining Failures to Panic 2014-11-20 23:45:42 +05:30
dynamic_lib.rs Make most of std::rt private 2014-11-20 17:19:24 -08:00
error.rs Switch to purely namespaced enums 2014-11-17 07:35:51 -08:00
failure.rs std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
fmt.rs std: Stabilize std::fmt 2014-11-18 21:16:22 -08:00
hash.rs DSTify Hash 2014-10-31 07:25:34 -05:00
lib.rs std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
macros.rs std: Add a new top-level thread_local module 2014-11-23 23:37:16 -08:00
os.rs rollup merge of #19205: jashank/docs-fix 2014-11-23 14:11:54 -05:00
prelude.rs Switch to purely namespaced enums 2014-11-17 07:35:51 -08:00
rtdeps.rs Fix spelling errors and capitalization. 2014-09-03 23:10:38 -04:00
task.rs Make most of std::rt private 2014-11-20 17:19:24 -08:00