diff --git a/src/test/run-pass/tls-init-on-init.rs b/src/test/run-pass/tls-init-on-init.rs index b5b9fb561ae7..48a0d4a99ecc 100644 --- a/src/test/run-pass/tls-init-on-init.rs +++ b/src/test/run-pass/tls-init-on-init.rs @@ -10,10 +10,9 @@ // ignore-emscripten no threads support -#![feature(thread_local_state)] -#![allow(deprecated)] +#![feature(thread_local_try_with)] -use std::thread::{self, LocalKeyState}; +use std::thread; use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; struct Foo { cnt: usize } @@ -38,10 +37,8 @@ impl Drop for Foo { FOO.with(|foo| assert_eq!(foo.cnt, 0)); } else { assert_eq!(self.cnt, 0); - match FOO.state() { - LocalKeyState::Valid => panic!("should not be in valid state"), - LocalKeyState::Uninitialized | - LocalKeyState::Destroyed => {} + if FOO.try_with(|_| ()).is_ok() { + panic!("should not be in valid state"); } } } diff --git a/src/test/run-pass/tls-try-with.rs b/src/test/run-pass/tls-try-with.rs index c072ec0679d7..552f4c5e829e 100644 --- a/src/test/run-pass/tls-try-with.rs +++ b/src/test/run-pass/tls-try-with.rs @@ -10,7 +10,7 @@ // ignore-emscripten no threads support -#![feature(thread_local_state)] +#![feature(thread_local_try_with)] use std::thread;