std: Second pass stabilization for thread_local#20354
Merged
bors merged 1 commit intorust-lang:masterfrom Jan 2, 2015
Merged
Conversation
Contributor
|
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
Member
Author
|
r? @aturon |
This commit performs a second pass over the `std::thread_local` module. Most of the functionality remains explicitly unstable, but the specific actions taken were: * `thread_local` is now stable * `thread_local!` is now stable * `thread_local::Key` is now stable * `thread_local::Key::with` is now stable * `thread_local::Key::destroyed` is deprecated in favor of a more general `state` function * `thread_local::Key::state` was added to query the three states that a key can be in: uninitialized, valid, or destroyed. This function, and the corresponding `State` enum, are both marked unstable as we may wish to expand it later on. * `thread_local::scoped` is entirely unstable. There hasn't been a whole lot of usage of this module in the standard distribution, so it remains unstable at this time. Note that while the structure `Key` is marked stable, it is currently forced to expose all of its implementation details due to the use of construction-via-macro. The use of construction-via-macro is currently required in order to place the `#[thread_local]` attribute on static in a platform-specific manner. These stability attributes were assigned assuming that it will be acceptable to tweak the implementation of `Key` in the future.
1a7769f to
be11aa6
Compare
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this pull request
Jan 2, 2015
Conflicts: src/libstd/sys/common/thread_info.rs
lnicola
pushed a commit
to lnicola/rust
that referenced
this pull request
Sep 1, 2025
…e-dbg Add remove literal dbg stmt for remove_dbg
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 8, 2025
…e-dbg Add remove literal dbg stmt for remove_dbg
makai410
pushed a commit
to makai410/rust
that referenced
this pull request
Nov 10, 2025
…e-dbg Add remove literal dbg stmt for remove_dbg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit performs a second pass over the
std::thread_localmodule. Most ofthe functionality remains explicitly unstable, but the specific actions taken
were:
thread_localis now stablethread_local!is now stablethread_local::Keyis now stablethread_local::Key::withis now stablethread_local::Key::destroyedis deprecated in favor of a more generalstatefunctionthread_local::Key::statewas added to query the three states that a key canbe in: uninitialized, valid, or destroyed. This function, and the
corresponding
Stateenum, are both marked unstable as we may wish to expandit later on.
thread_local::scopedis entirely unstable. There hasn't been a whole lot ofusage of this module in the standard distribution, so it remains unstable at
this time.
Note that while the structure
Keyis marked stable, it is currently forced toexpose all of its implementation details due to the use of
construction-via-macro. The use of construction-via-macro is currently required
in order to place the
#[thread_local]attribute on static in aplatform-specific manner. These stability attributes were assigned assuming that
it will be acceptable to tweak the implementation of
Keyin the future.