Skip to content

Commit 78e06ad

Browse files
committed
Mention that the panic hook will always run
1 parent 179539f commit 78e06ad

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/libstd/panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ pub fn recover<F: FnOnce() -> R + UnwindSafe, R>(f: F) -> Result<R> {
395395
catch_unwind(f)
396396
}
397397

398-
/// Triggers a panic without invoking the panic handler.
398+
/// Triggers a panic without invoking the panic hook.
399399
///
400400
/// This is designed to be used in conjunction with `catch_unwind` to, for
401401
/// example, carry a panic across a layer of C code.

src/libstd/panicking.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,11 @@ static FIRST_PANIC: AtomicBool = AtomicBool::new(true);
7575

7676
/// Registers a custom panic hook, replacing any that was previously registered.
7777
///
78-
/// The panic hook is invoked when a thread panics, but before it begins
79-
/// unwinding the stack. The default hook prints a message to standard error
80-
/// and generates a backtrace if requested, but this behavior can be customized
81-
/// with the `set_hook` and `take_hook` functions.
78+
/// The panic hook is invoked when a thread panics, but before the panic runtime
79+
/// is invoked. As such, the hook will run with both the aborting and unwinding
80+
/// runtimes. The default hook prints a message to standard error and generates
81+
/// a backtrace if requested, but this behavior can be customized with the
82+
/// `set_hook` and `take_hook` functions.
8283
///
8384
/// The hook is provided with a `PanicInfo` struct which contains information
8485
/// about the origin of the panic, including the payload passed to `panic!` and

0 commit comments

Comments
 (0)