src/libstd/thread_local/scoped.rs: fixes scoped_thread_local! macro

was missing a ;
This commit is contained in:
arturo 2014-12-27 21:08:47 +01:00
parent 3e6b29f8ad
commit a4549972f2

View File

@ -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());
}
}