diff options
Diffstat (limited to 'src/libstd/thread_local/scoped.rs')
| -rw-r--r-- | src/libstd/thread_local/scoped.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index ee742ab8375..7762d225b9a 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -24,7 +24,7 @@ //! # Example //! //! ``` -//! scoped_thread_local!(static FOO: uint) +//! scoped_thread_local!(static FOO: uint); //! //! // Initially each scoped slot is empty. //! assert!(!FOO.is_set()); @@ -60,18 +60,18 @@ pub struct Key<T> { #[doc(hidden)] pub inner: KeyInner<T> } /// This macro declares a `static` item on which methods are used to get and /// set the value stored within. #[macro_export] -macro_rules! scoped_thread_local( +macro_rules! scoped_thread_local { (static $name:ident: $t:ty) => ( __scoped_thread_local_inner!(static $name: $t) ); (pub static $name:ident: $t:ty) => ( __scoped_thread_local_inner!(pub static $name: $t) ); -) +} #[macro_export] #[doc(hidden)] -macro_rules! __scoped_thread_local_inner( +macro_rules! __scoped_thread_local_inner { (static $name:ident: $t:ty) => ( #[cfg_attr(not(any(windows, target_os = "android", target_os = "ios")), thread_local)] @@ -104,7 +104,7 @@ macro_rules! __scoped_thread_local_inner( INIT }) -) +} impl<T> Key<T> { /// Insert a value into this scoped thread local storage slot for a @@ -119,7 +119,7 @@ impl<T> Key<T> { /// # Example /// /// ``` - /// scoped_thread_local!(static FOO: uint) + /// scoped_thread_local!(static FOO: uint); /// /// FOO.set(&100, || { /// let val = FOO.with(|v| *v); @@ -171,7 +171,7 @@ impl<T> Key<T> { /// # Example /// /// ```no_run - /// scoped_thread_local!(static FOO: uint) + /// scoped_thread_local!(static FOO: uint); /// /// FOO.with(|slot| { /// // work with `slot` @@ -239,7 +239,7 @@ mod tests { #[test] fn smoke() { - scoped_thread_local!(static BAR: uint) + scoped_thread_local!(static BAR: uint); assert!(!BAR.is_set()); BAR.set(&1, || { @@ -253,7 +253,7 @@ mod tests { #[test] fn cell_allowed() { - scoped_thread_local!(static BAR: Cell<uint>) + scoped_thread_local!(static BAR: Cell<uint>); BAR.set(&Cell::new(1), || { BAR.with(|slot| { |
