about summary refs log tree commit diff
path: root/src/libstd/thread/mod.rs
diff options
context:
space:
mode:
authorJake Goulding <jake.goulding@gmail.com>2017-10-01 14:55:58 -0400
committerJake Goulding <jake.goulding@gmail.com>2017-10-08 10:29:32 -0400
commitb5b7666120658e332c1ea26e8bb3944aefde31ca (patch)
treefbfb1ee159a70973dde6b151f72ba1429b54b334 /src/libstd/thread/mod.rs
parentff8e264950b070578c8c8187241f4ca55ebf28fe (diff)
downloadrust-b5b7666120658e332c1ea26e8bb3944aefde31ca.tar.gz
rust-b5b7666120658e332c1ea26e8bb3944aefde31ca.zip
Don't encourage people to ignore threading errors in the docs
Diffstat (limited to 'src/libstd/thread/mod.rs')
-rw-r--r--src/libstd/thread/mod.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 30887b16c60..07bbddc62b9 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -485,15 +485,17 @@ impl Builder {
 /// let (tx, rx) = channel();
 ///
 /// let sender = thread::spawn(move || {
-///     let _ = tx.send("Hello, thread".to_owned());
+///     tx.send("Hello, thread".to_owned())
+///         .expect("Unable to send on channel");
 /// });
 ///
 /// let receiver = thread::spawn(move || {
-///     println!("{}", rx.recv().unwrap());
+///     let value = rx.recv().expect("Unable to receive from channel");
+///     println!("{}", value);
 /// });
 ///
-/// let _ = sender.join();
-/// let _ = receiver.join();
+/// sender.join().expect("The sender thread has panicked");
+/// receiver.join().expect("The receiver thread has panicked");
 /// ```
 ///
 /// A thread can also return a value through its [`JoinHandle`], you can use
@@ -1192,7 +1194,7 @@ impl<T> JoinInner<T> {
 ///     });
 /// });
 ///
-/// let _ = original_thread.join();
+/// original_thread.join().expect("The thread being joined has panicked");
 /// println!("Original thread is joined.");
 ///
 /// // We make sure that the new thread has time to run, before the main