@@ -1124,7 +1124,15 @@ pub fn exit(code: i32) -> ! {
1124
1124
///
1125
1125
/// Note that because this function never returns, and that it terminates the
1126
1126
/// 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
1128
1136
/// this function at a known point where there are no more destructors left
1129
1137
/// to run.
1130
1138
///
@@ -1142,7 +1150,7 @@ pub fn exit(code: i32) -> ! {
1142
1150
/// }
1143
1151
/// ```
1144
1152
///
1145
- /// The [ `abort`] function terminates the process, so the destructor will not
1153
+ /// The `abort` function terminates the process, so the destructor will not
1146
1154
/// get run on the example below:
1147
1155
///
1148
1156
/// ```no_run
@@ -1162,6 +1170,9 @@ pub fn exit(code: i32) -> ! {
1162
1170
/// // the destructor implemented for HasDrop will never get run
1163
1171
/// }
1164
1172
/// ```
1173
+ ///
1174
+ /// [`panic!`]: ../../std/macro.panic.html
1175
+ /// [panic hook]: ../../std/panic/fn.set_hook.html
1165
1176
#[ stable( feature = "process_abort" , since = "1.17.0" ) ]
1166
1177
pub fn abort ( ) -> ! {
1167
1178
unsafe { :: sys:: abort_internal ( ) } ;
0 commit comments