diff options
| author | arturo <arturo@openframeworks.cc> | 2014-12-27 21:08:47 +0100 |
|---|---|---|
| committer | arturo <arturo@openframeworks.cc> | 2014-12-28 19:43:04 +0100 |
| commit | a4549972f29e1838e5e9de924e69111909064e81 (patch) | |
| tree | 12ae5520e0262454cfb715c3ffe18a4c511ec616 /src/libstd/thread_local | |
| parent | 3e6b29f8ad1ddfcb134d743a66ee5f467e16c350 (diff) | |
| download | rust-a4549972f29e1838e5e9de924e69111909064e81.tar.gz rust-a4549972f29e1838e5e9de924e69111909064e81.zip | |
src/libstd/thread_local/scoped.rs: fixes scoped_thread_local! macro
was missing a ;
Diffstat (limited to 'src/libstd/thread_local')
| -rw-r--r-- | src/libstd/thread_local/scoped.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index 756c86c2115..5f96548c053 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -62,10 +62,10 @@ pub struct Key<T> { #[doc(hidden)] pub inner: KeyInner<T> } #[macro_export] macro_rules! scoped_thread_local { (static $name:ident: $t:ty) => ( - __scoped_thread_local_inner!(static $name: $t) + __scoped_thread_local_inner!(static $name: $t); ); (pub static $name:ident: $t:ty) => ( - __scoped_thread_local_inner!(pub static $name: $t) + __scoped_thread_local_inner!(pub static $name: $t); ); } @@ -240,6 +240,8 @@ mod tests { use cell::Cell; use prelude::*; + scoped_thread_local!(static FOO: uint); + #[test] fn smoke() { scoped_thread_local!(static BAR: uint); @@ -264,4 +266,16 @@ mod tests { }); }); } + + #[test] + fn scope_item_allowed() { + assert!(!FOO.is_set()); + FOO.set(&1, || { + assert!(FOO.is_set()); + FOO.with(|slot| { + assert_eq!(*slot, 1); + }); + }); + assert!(!FOO.is_set()); + } } |
