Skip to content

Commit 8240ed2

Browse files
author
Vytautas Astrauskas
committed
Change the test not to rely on internals.
1 parent 90e9a87 commit 8240ed2

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

tests/run-pass/concurrency/tls_lib_drop.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
//! Check that destructors of the library thread locals are executed immediately
44
//! after a thread terminates.
5-
//!
6-
//! FIXME: We should have a similar test for thread-local statics (statics
7-
//! annotated with `#[thread_local]`) once they support destructors.
8-
9-
#![feature(thread_local_internals)]
105
116
use std::cell::RefCell;
127
use std::thread;
@@ -21,20 +16,9 @@ impl Drop for TestCell {
2116
}
2217
}
2318

24-
static A: std::thread::LocalKey<TestCell> = {
25-
#[inline]
26-
fn __init() -> TestCell {
27-
TestCell { value: RefCell::new(0) }
28-
}
29-
30-
unsafe fn __getit() -> Option<&'static TestCell> {
31-
static __KEY: std::thread::__OsLocalKeyInner<TestCell> =
32-
std::thread::__OsLocalKeyInner::new();
33-
__KEY.get(__init)
34-
}
35-
36-
unsafe { std::thread::LocalKey::new(__getit) }
37-
};
19+
thread_local! {
20+
static A: TestCell = TestCell { value: RefCell::new(0) };
21+
}
3822

3923
fn main() {
4024
thread::spawn(|| {

0 commit comments

Comments
 (0)