From 568700097950cf66b09dfdf3d608d4f51e0f64ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Nov 2017 11:26:46 +0200 Subject: [PATCH 1/4] Update the std::thread docs and clarify that panics can nowadays be caught --- src/libstd/thread/mod.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 28a33c7ec14..8c60d9c7bf0 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -25,11 +25,15 @@ //! //! Fatal logic errors in Rust cause *thread panic*, during which //! a thread will unwind the stack, running destructors and freeing -//! owned resources. Thread panic is unrecoverable from within -//! the panicking thread (i.e. there is no 'try/catch' in Rust), but -//! the panic may optionally be detected from a different thread. If -//! the main thread panics, the application will exit with a non-zero -//! exit code. +//! owned resources. While not meant as a 'try/catch' mechanism, panics +//! in Rust can nonetheless be caught with +//! ['catch_unwind'](../../std/panic/fn.catch_unwind.html) and recovered +//! from, or alternatively be resumed with +//! ['resume_unwind'](../../std/panic/fn.resume_unwind.html). If the panic +//! is not caught the thread will exit, but the panic may optionally be +//! detected from a different thread with `join`. If the main thread panics +//! without the panic being caught, the application will exit with a +//! non-zero exit code. //! //! When the main thread of a Rust program terminates, the entire program shuts //! down, even if other threads are still running. However, this module provides From 283b4a1b0bcf94fed0ebc3bfd84e87d17ca1b587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Nov 2017 18:29:52 +0200 Subject: [PATCH 2/4] Use ` instead of ' for function names --- src/libstd/thread/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 8c60d9c7bf0..da5965d801c 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -27,9 +27,9 @@ //! a thread will unwind the stack, running destructors and freeing //! owned resources. While not meant as a 'try/catch' mechanism, panics //! in Rust can nonetheless be caught with -//! ['catch_unwind'](../../std/panic/fn.catch_unwind.html) and recovered +//! [`catch_unwind`](../../std/panic/fn.catch_unwind.html) and recovered //! from, or alternatively be resumed with -//! ['resume_unwind'](../../std/panic/fn.resume_unwind.html). If the panic +//! [`resume_unwind`](../../std/panic/fn.resume_unwind.html). If the panic //! is not caught the thread will exit, but the panic may optionally be //! detected from a different thread with `join`. If the main thread panics //! without the panic being caught, the application will exit with a From a12f5119101060909de1938d7d4a96854cc02780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Nov 2017 18:30:02 +0200 Subject: [PATCH 3/4] Mention that panics can't possibly be caught when compiling with panic=abort --- src/libstd/thread/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index da5965d801c..97220ad993b 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -26,7 +26,7 @@ //! Fatal logic errors in Rust cause *thread panic*, during which //! a thread will unwind the stack, running destructors and freeing //! owned resources. While not meant as a 'try/catch' mechanism, panics -//! in Rust can nonetheless be caught with +//! in Rust can nonetheless be caught (unless compiling with `panic=abort`) with //! [`catch_unwind`](../../std/panic/fn.catch_unwind.html) and recovered //! from, or alternatively be resumed with //! [`resume_unwind`](../../std/panic/fn.resume_unwind.html). If the panic From b86bba594023591f4d6c795cf4da115640c3a918 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Nov 2017 19:09:31 +0200 Subject: [PATCH 4/4] Make join a link to the function's documentation --- src/libstd/thread/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 97220ad993b..ee49bf796b8 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -31,7 +31,7 @@ //! from, or alternatively be resumed with //! [`resume_unwind`](../../std/panic/fn.resume_unwind.html). If the panic //! is not caught the thread will exit, but the panic may optionally be -//! detected from a different thread with `join`. If the main thread panics +//! detected from a different thread with [`join`]. If the main thread panics //! without the panic being caught, the application will exit with a //! non-zero exit code. //!