2 #![allow(stable_features)]
4 // ignore-emscripten no threads support
6 #![feature(thread_local_try_with)]
10 static mut DROP_RUN: bool = false;
14 thread_local!(static FOO: Foo = Foo {});
18 assert!(FOO.try_with(|_| panic!("`try_with` closure run")).is_err());
19 unsafe { DROP_RUN = true; }
25 assert_eq!(FOO.try_with(|_| {
27 }).expect("`try_with` failed"), 132);
29 assert!(unsafe { DROP_RUN });