File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,10 @@ pub struct Key<T> { #[doc(hidden)] pub inner: KeyInner<T> }
6262#[ macro_export]
6363macro_rules! scoped_thread_local {
6464 ( static $name: ident: $t: ty) => (
65- __scoped_thread_local_inner!( static $name: $t)
65+ __scoped_thread_local_inner!( static $name: $t) ;
6666 ) ;
6767 ( pub static $name: ident: $t: ty) => (
68- __scoped_thread_local_inner!( pub static $name: $t)
68+ __scoped_thread_local_inner!( pub static $name: $t) ;
6969 ) ;
7070}
7171
@@ -240,6 +240,8 @@ mod tests {
240240 use cell:: Cell ;
241241 use prelude:: * ;
242242
243+ scoped_thread_local ! ( static FOO : uint) ;
244+
243245 #[ test]
244246 fn smoke ( ) {
245247 scoped_thread_local ! ( static BAR : uint) ;
@@ -264,4 +266,16 @@ mod tests {
264266 } ) ;
265267 } ) ;
266268 }
269+
270+ #[ test]
271+ fn scope_item_allowed ( ) {
272+ assert ! ( !FOO . is_set( ) ) ;
273+ FOO . set ( & 1 , || {
274+ assert ! ( FOO . is_set( ) ) ;
275+ FOO . with ( |slot| {
276+ assert_eq ! ( * slot, 1 ) ;
277+ } ) ;
278+ } ) ;
279+ assert ! ( !FOO . is_set( ) ) ;
280+ }
267281}
You can’t perform that action at this time.
0 commit comments