diff options
| author | bors <bors@rust-lang.org> | 2015-01-28 03:59:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-01-28 03:59:14 +0000 |
| commit | a530cc9706324ad44dba464d541a807eb5afdb08 (patch) | |
| tree | a8f9e5444cf2378b9c3d5a193484a3f6c9873a06 /src/libstd/thread_local | |
| parent | 92ff8ea52816982ad4cbfac8168e216d32d74c77 (diff) | |
| parent | 71223050538939ed758fcd3b9114f71abff20bb2 (diff) | |
| download | rust-a530cc9706324ad44dba464d541a807eb5afdb08.tar.gz rust-a530cc9706324ad44dba464d541a807eb5afdb08.zip | |
Auto merge of #21248 - brson:feature-staging, r=alexcrichton
This implements the remaining bits of 'feature staging', as described in [RFC 507](https://github.com/rust-lang/rfcs/blob/master/text/0507-release-channels.md).
This is not quite done, but the substance of the work is complete so submitting for early review.
Key changes:
* `unstable`, `stable` and `deprecated` attributes all require 'feature' and 'since', and support an optional 'reason'.
* The `unstable` lint is removed.
* A new 'stability checking' pass warns when a used unstable library feature has not been activated with the `feature` attribute. At 1.0 beta this will become an error.
* A new 'unused feature checking' pass emits a lint ('unused_feature', renamed from 'unknown_feature') for any features that were activated but not used.
* A new tidy script `featureck.py` performs some global sanity checking, particularly that 'since' numbers agree, and also prints out a summary of features.
Differences from RFC:
* As implemented `unstable` requires a `since` attribute. I do not know if this is useful. I included it in the original sed script and just left it.
* RFC didn't specify the name of the optional 'reason' attribute.
* This continues to use 'unstable', 'stable' and 'deprecated' names (the 'nice' names) instead of 'staged_unstable', but only activates them with the crate-level 'staged_api' attribute.
I intend to update the RFC based on the outcome of this PR.
Issues:
* The unused feature check doesn't account for language features - i.e. you can activate a language feature, not use it, and not get the error.
Open questions:
* All unstable and deprecated features are named 'unnamed_feature', which i picked just because it is uniquely greppable. This is the 'catch-all' feature. What should it be?
* All stable features are named 'grandfathered'. What should this be?
TODO:
* Add check that all `deprecated` attributes are paired with a `stable` attribute in order to preserve the knowledge about when a feature became stable.
* Update rustdoc in various ways.
* Remove obsolete stability discussion from reference.
* Add features for 'path', 'io', 'os', 'hash' and 'rand'.
cc #20445 @alexcrichton @aturon
Diffstat (limited to 'src/libstd/thread_local')
| -rw-r--r-- | src/libstd/thread_local/mod.rs | 18 | ||||
| -rw-r--r-- | src/libstd/thread_local/scoped.rs | 5 |
2 files changed, 14 insertions, 9 deletions
diff --git a/src/libstd/thread_local/mod.rs b/src/libstd/thread_local/mod.rs index f7a2f8e10e9..2a9bf452329 100644 --- a/src/libstd/thread_local/mod.rs +++ b/src/libstd/thread_local/mod.rs @@ -34,7 +34,7 @@ //! will want to make use of some form of **interior mutability** through the //! `Cell` or `RefCell` types. -#![stable] +#![stable(feature = "rust1", since = "1.0.0")] use prelude::v1::*; @@ -93,7 +93,7 @@ pub mod __impl { /// assert_eq!(*f.borrow(), 2); /// }); /// ``` -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] pub struct Key<T> { // The key itself may be tagged with #[thread_local], and this `Key` is // stored as a `static`, and it's not valid for a static to reference the @@ -113,7 +113,7 @@ pub struct Key<T> { /// Declare a new thread local storage key of type `std::thread_local::Key`. #[macro_export] -#[stable] +#[stable(feature = "rust1", since = "1.0.0")] macro_rules! thread_local { (static $name:ident: $t:ty = $init:expr) => ( static $name: ::std::thread_local::Key<$t> = { @@ -218,7 +218,8 @@ macro_rules! __thread_local_inner { } /// Indicator of the state of a thread local storage key. -#[unstable = "state querying was recently added"] +#[unstable(feature = "std_misc", + reason = "state querying was recently added")] #[derive(Eq, PartialEq, Copy)] pub enum State { /// All keys are in this state whenever a thread starts. Keys will @@ -258,7 +259,7 @@ impl<T: 'static> Key<T> { /// This function will `panic!()` if the key currently has its /// destructor running, and it **may** panic if the destructor has /// previously been run for this thread. - #[stable] + #[stable(feature = "rust1", since = "1.0.0")] pub fn with<F, R>(&'static self, f: F) -> R where F: FnOnce(&T) -> R { let slot = (self.inner)(); @@ -301,7 +302,8 @@ impl<T: 'static> Key<T> { /// initialization does not panic. Keys in the `Valid` state are guaranteed /// to be able to be accessed. Keys in the `Destroyed` state will panic on /// any call to `with`. - #[unstable = "state querying was recently added"] + #[unstable(feature = "std_misc", + reason = "state querying was recently added")] pub fn state(&'static self) -> State { unsafe { match (self.inner)().get() { @@ -317,7 +319,9 @@ impl<T: 'static> Key<T> { } /// Deprecated - #[deprecated = "function renamed to state() and returns more info"] + #[unstable(feature = "std_misc")] + #[deprecated(since = "1.0.0", + reason = "function renamed to state() and returns more info")] pub fn destroyed(&'static self) -> bool { self.state() == State::Destroyed } } diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index 1fb5652bc0c..1a20612d60a 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -38,8 +38,9 @@ //! }); //! ``` -#![unstable = "scoped TLS has yet to have wide enough use to fully consider \ - stabilizing its interface"] +#![unstable(feature = "std_misc", + reason = "scoped TLS has yet to have wide enough use to fully consider \ + stabilizing its interface")] use prelude::v1::*; |
