about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-10-04 05:43:00 +0000
committerbors <bors@rust-lang.org>2017-10-04 05:43:00 +0000
commiteabef0608b030ca8844545837967b29ca4a058b7 (patch)
tree3d87debecd859aa6f1c4579e7b1a1d76e4835db4 /src/libstd
parentf1938cf13b3c6973514cb36fd96423623afcb3da (diff)
parent28ef0d1085120d72741bc52fc2dacfe18ebe8a2e (diff)
downloadrust-eabef0608b030ca8844545837967b29ca4a058b7.tar.gz
rust-eabef0608b030ca8844545837967b29ca4a058b7.zip
Auto merge of #44905 - Pirh:process_abort_docs, r=steveklabnik
Update docs for process::abort

Remove a typo and explain the relationship to `panic!`.

Part of #29370

r? @steveklabnik
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/process.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 1869ad3ed70..dbb58991215 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -1124,7 +1124,15 @@ pub fn exit(code: i32) -> ! {
 ///
 /// Note that because this function never returns, and that it terminates the
 /// process, no destructors on the current stack or any other thread's stack
-/// will be run. If a clean shutdown is needed it is recommended to only call
+/// will be run.
+///
+/// This is in contrast to the default behaviour of [`panic!`] which unwinds
+/// the current thread's stack and calls all destructors.
+/// When `panic="abort"` is set, either as an argument to `rustc` or in a
+/// crate's Cargo.toml, [`panic!`] and `abort` are similar. However,
+/// [`panic!`] will still call the [panic hook] while `abort` will not.
+///
+/// If a clean shutdown is needed it is recommended to only call
 /// this function at a known point where there are no more destructors left
 /// to run.
 ///
@@ -1142,7 +1150,7 @@ pub fn exit(code: i32) -> ! {
 /// }
 /// ```
 ///
-/// The [`abort`] function terminates the process, so the destructor will not
+/// The `abort` function terminates the process, so the destructor will not
 /// get run on the example below:
 ///
 /// ```no_run
@@ -1162,6 +1170,9 @@ pub fn exit(code: i32) -> ! {
 ///     // the destructor implemented for HasDrop will never get run
 /// }
 /// ```
+///
+/// [`panic!`]: ../../std/macro.panic.html
+/// [panic hook]: ../../std/panic/fn.set_hook.html
 #[stable(feature = "process_abort", since = "1.17.0")]
 pub fn abort() -> ! {
     unsafe { ::sys::abort_internal() };