Skip to content

Commit eabef06

Browse files
committed
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
2 parents f1938cf + 28ef0d1 commit eabef06

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/libstd/process.rs

+13-2
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,15 @@ pub fn exit(code: i32) -> ! {
11241124
///
11251125
/// Note that because this function never returns, and that it terminates the
11261126
/// process, no destructors on the current stack or any other thread's stack
1127-
/// will be run. If a clean shutdown is needed it is recommended to only call
1127+
/// will be run.
1128+
///
1129+
/// This is in contrast to the default behaviour of [`panic!`] which unwinds
1130+
/// the current thread's stack and calls all destructors.
1131+
/// When `panic="abort"` is set, either as an argument to `rustc` or in a
1132+
/// crate's Cargo.toml, [`panic!`] and `abort` are similar. However,
1133+
/// [`panic!`] will still call the [panic hook] while `abort` will not.
1134+
///
1135+
/// If a clean shutdown is needed it is recommended to only call
11281136
/// this function at a known point where there are no more destructors left
11291137
/// to run.
11301138
///
@@ -1142,7 +1150,7 @@ pub fn exit(code: i32) -> ! {
11421150
/// }
11431151
/// ```
11441152
///
1145-
/// The [`abort`] function terminates the process, so the destructor will not
1153+
/// The `abort` function terminates the process, so the destructor will not
11461154
/// get run on the example below:
11471155
///
11481156
/// ```no_run
@@ -1162,6 +1170,9 @@ pub fn exit(code: i32) -> ! {
11621170
/// // the destructor implemented for HasDrop will never get run
11631171
/// }
11641172
/// ```
1173+
///
1174+
/// [`panic!`]: ../../std/macro.panic.html
1175+
/// [panic hook]: ../../std/panic/fn.set_hook.html
11651176
#[stable(feature = "process_abort", since = "1.17.0")]
11661177
pub fn abort() -> ! {
11671178
unsafe { ::sys::abort_internal() };

0 commit comments

Comments
 (0)