From 082dd6d7af37ac76d99147ae7242080d4f5c74aa Mon Sep 17 00:00:00 2001 From: Stjepan Glavina Date: Wed, 28 Feb 2018 20:50:26 +0100 Subject: [PATCH] Fix a few run-pass tests --- src/test/run-pass/tls-init-on-init.rs | 11 ++++------- src/test/run-pass/tls-try-with.rs | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/test/run-pass/tls-init-on-init.rs b/src/test/run-pass/tls-init-on-init.rs index b5b9fb561ae7e..48a0d4a99ecc9 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 c072ec0679d73..552f4c5e829e1 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;