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> }
62
62
#[ macro_export]
63
63
macro_rules! scoped_thread_local {
64
64
( static $name: ident: $t: ty) => (
65
- __scoped_thread_local_inner!( static $name: $t)
65
+ __scoped_thread_local_inner!( static $name: $t) ;
66
66
) ;
67
67
( pub static $name: ident: $t: ty) => (
68
- __scoped_thread_local_inner!( pub static $name: $t)
68
+ __scoped_thread_local_inner!( pub static $name: $t) ;
69
69
) ;
70
70
}
71
71
@@ -240,6 +240,8 @@ mod tests {
240
240
use cell:: Cell ;
241
241
use prelude:: * ;
242
242
243
+ scoped_thread_local ! ( static FOO : uint) ;
244
+
243
245
#[ test]
244
246
fn smoke ( ) {
245
247
scoped_thread_local ! ( static BAR : uint) ;
@@ -264,4 +266,16 @@ mod tests {
264
266
} ) ;
265
267
} ) ;
266
268
}
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
+ }
267
281
}
You can’t perform that action at this time.
0 commit comments