]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/unit-like-struct-drop-run.rs
cleanup: s/impl Copy/#[derive(Copy)]/g
[rust.git] / src / test / run-pass / unit-like-struct-drop-run.rs
index e3cd694c0de6b910ac0c0076ef60bff7adf5703c..3c50712b4647f1d6c7c115468861cac7d0a40a72 100644 (file)
@@ -11,7 +11,7 @@
 // Make sure the destructor is run for unit-like structs.
 
 use std::boxed::BoxAny;
-use std::task;
+use std::thread::Thread;
 
 struct Foo;
 
@@ -22,10 +22,10 @@ fn drop(&mut self) {
 }
 
 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.");
 }