diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-08-15 23:16:59 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-08-16 14:37:24 +1000 |
| commit | 3ad23552fbd463d97a3e26c900655b9d134516e4 (patch) | |
| tree | 5507ee278d6cde91ab847d802f04ca372775b620 /src/libstd | |
| parent | 790e6bb3972c3b167a8e0314305740a20f62d2f0 (diff) | |
| download | rust-3ad23552fbd463d97a3e26c900655b9d134516e4.tar.gz rust-3ad23552fbd463d97a3e26c900655b9d134516e4.zip | |
syntax: add a local_data_key macro that creates a key for access to the TLS.
This allows the internal implementation details of the TLS keys to be changed without requiring the update of all the users. (Or, applying changes that have to be applied for the keys to work correctly, e.g. forcing LLVM to not merge these constants.)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/local_data.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index a73809d202c..4dbe61b0c49 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -24,8 +24,8 @@ wish to store. ~~~{.rust} use std::local_data; -static key_int: local_data::Key<int> = &local_data::Key; -static key_vector: local_data::Key<~[int]> = &local_data::Key; +local_data_key!(key_int: int); +local_data_key!(key_vector: ~[int]); local_data::set(key_int, 3); local_data::get(key_int, |opt| assert_eq!(opt, Some(&3))); |
