Skip to content

Commit 6b473b2

Browse files
committed
rollup merge of #20262: arturoc/fix-scoped_thread_local
was missing a couple of semicolons and applications using it failed to compile
2 parents 2fea594 + a454997 commit 6b473b2

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/libstd/thread_local/scoped.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ pub struct Key<T> { #[doc(hidden)] pub inner: KeyInner<T> }
6262
#[macro_export]
6363
macro_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
}

0 commit comments

Comments
 (0)