Skip to content

Commit

Permalink
Explain difference between panic! and abort in abort docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pirh committed Sep 27, 2017
1 parent 6dfa45d commit 7ab20c8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,14 @@ 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 equivalent.
///
/// 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 Down Expand Up @@ -1162,6 +1169,8 @@ pub fn exit(code: i32) -> ! {
/// // the destructor implemented for HasDrop will never get run
/// }
/// ```
///
/// [`panic!`]: ../../std/macro.panic.html
#[stable(feature = "process_abort", since = "1.17.0")]
pub fn abort() -> ! {
unsafe { ::sys::abort_internal() };
Expand Down

0 comments on commit 7ab20c8

Please sign in to comment.