diff options
| author | Pirh <pirh.badger@gmail.com> | 2017-09-27 22:47:21 +0100 |
|---|---|---|
| committer | Pirh <pirh.badger@gmail.com> | 2017-09-27 22:47:21 +0100 |
| commit | 7ab20c850e23618d4b8acea22e8930a52b783289 (patch) | |
| tree | 0179e359e2efd9bbee73404334f13aba4c5e519d /src/libstd | |
| parent | 6dfa45d2ed83ecf25bf457201a3d482be42856ca (diff) | |
| download | rust-7ab20c850e23618d4b8acea22e8930a52b783289.tar.gz rust-7ab20c850e23618d4b8acea22e8930a52b783289.zip | |
Explain difference between panic! and abort in abort docs
As per #29370
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/process.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libstd/process.rs b/src/libstd/process.rs index d1cb90826f9..fa9ec4b3185 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -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. /// @@ -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() }; |
