}
/// Redirect thread-local stdout.
- #[experimental = "Will likely go away after proc removal"]
+ #[unstable = "Will likely go away after proc removal"]
pub fn stdout(mut self, stdout: Box<Writer + Send>) -> Builder {
self.stdout = Some(stdout);
self
}
/// Redirect thread-local stderr.
- #[experimental = "Will likely go away after proc removal"]
+ #[unstable = "Will likely go away after proc removal"]
pub fn stderr(mut self, stderr: Box<Writer + Send>) -> Builder {
self.stderr = Some(stderr);
self
unsafe { imp::yield_now() }
}
- /// Determines whether the current thread is panicking.
+ /// Determines whether the current thread is unwinding because of panic.
#[inline]
#[stable]
pub fn panicking() -> bool {
impl<T: Send> JoinGuard<'static, T> {
/// Detaches the child thread, allowing it to outlive its parent.
- #[experimental = "unsure whether this API imposes limitations elsewhere"]
+ #[unstable = "unsure whether this API imposes limitations elsewhere"]
pub fn detach(mut self) {
unsafe { imp::detach(self.native) };
self.joined = true; // avoid joining in the destructor
fn test_unnamed_thread() {
Thread::scoped(move|| {
assert!(Thread::current().name().is_none());
- }).join().map_err(|_| ()).unwrap();
+ }).join().ok().unwrap();
}
#[test]
fn test_named_thread() {
Builder::new().name("ada lovelace".to_string()).scoped(move|| {
assert!(Thread::current().name().unwrap() == "ada lovelace".to_string());
- }).join().map_err(|_| ()).unwrap();
+ }).join().ok().unwrap();
}
#[test]
Err(e) => {
type T = &'static str;
assert!(e.is::<T>());
- assert_eq!(*e.downcast::<T>().unwrap(), "static string");
+ assert_eq!(*e.downcast::<T>().ok().unwrap(), "static string");
}
Ok(()) => panic!()
}
Err(e) => {
type T = String;
assert!(e.is::<T>());
- assert_eq!(*e.downcast::<T>().unwrap(), "owned string".to_string());
+ assert_eq!(*e.downcast::<T>().ok().unwrap(), "owned string".to_string());
}
Ok(()) => panic!()
}
Err(e) => {
type T = Box<Any + Send>;
assert!(e.is::<T>());
- let any = e.downcast::<T>().unwrap();
+ let any = e.downcast::<T>().ok().unwrap();
assert!(any.is::<u16>());
- assert_eq!(*any.downcast::<u16>().unwrap(), 413u16);
+ assert_eq!(*any.downcast::<u16>().ok().unwrap(), 413u16);
}
Ok(()) => panic!()
}