// Make sure the destructor is run for unit-like structs.
use std::boxed::BoxAny;
-use std::task;
+use std::thread::Thread;
struct Foo;
}
pub fn main() {
- let x = task::try(move|| {
+ let x = Thread::scoped(move|| {
let _b = Foo;
- });
+ }).join();
- let s = x.unwrap_err().downcast::<&'static str>().unwrap();
+ let s = x.err().unwrap().downcast::<&'static str>().ok().unwrap();
assert_eq!(s.as_slice(), "This panic should happen.");
}