diff options
Diffstat (limited to 'src/libstd/thread.rs')
| -rw-r--r-- | src/libstd/thread.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index ec2718bef69..09f50059936 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -388,7 +388,7 @@ impl Thread { unsafe { imp::yield_now() } } - /// Determines whether the current thread is panicking. + /// Determines whether the current thread is unwinding because of panic. #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn panicking() -> bool { @@ -527,14 +527,14 @@ mod test { 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] @@ -670,7 +670,7 @@ mod 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!() } @@ -684,7 +684,7 @@ mod test { 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!() } @@ -698,9 +698,9 @@ mod test { 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!() } |
