about summary refs log tree commit diff
path: root/src/libstd/thread_local
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-29 16:36:25 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-29 16:36:25 -0800
commit6b473b2e05210c21d51f72a292cb11104102d8b1 (patch)
treec247640c4286f752607281a205725446cc6e4ca9 /src/libstd/thread_local
parent2fea5944446eca6a45a50cd4e2b92b1471232fa8 (diff)
parenta4549972f29e1838e5e9de924e69111909064e81 (diff)
downloadrust-6b473b2e05210c21d51f72a292cb11104102d8b1.tar.gz
rust-6b473b2e05210c21d51f72a292cb11104102d8b1.zip
rollup merge of #20262: arturoc/fix-scoped_thread_local
was missing a couple of semicolons and applications using it failed to compile
Diffstat (limited to 'src/libstd/thread_local')
-rw-r--r--src/libstd/thread_local/scoped.rs18
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());
+    }
 }