Skip to content

Commit

Permalink
Auto merge of #44905 - Pirh:process_abort_docs, r=steveklabnik
Browse files Browse the repository at this point in the history
Update docs for process::abort

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

Part of #29370

r? @steveklabnik
  • Loading branch information
bors committed Oct 4, 2017
2 parents f1938cf + 28ef0d1 commit eabef06
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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
Expand All @@ -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() };
Expand Down

0 comments on commit eabef06

Please sign in to comment.