diff options
| author | Julian Frimmel <julian.frimmel@gmail.com> | 2021-03-18 15:15:28 +0100 |
|---|---|---|
| committer | Julian Frimmel <julian.frimmel@gmail.com> | 2021-03-18 15:15:28 +0100 |
| commit | d5e45b50cdfc029a061229d9edf5f5fa58eb0353 (patch) | |
| tree | 6ef6bf32d6b631281d65119a842d22fc7c27a1c2 | |
| parent | 61e5d549b49152b5fdc714fde93ab5c55e301127 (diff) | |
| download | rust-d5e45b50cdfc029a061229d9edf5f5fa58eb0353.tar.gz rust-d5e45b50cdfc029a061229d9edf5f5fa58eb0353.zip | |
Incorporate review feedback #2
| -rw-r--r-- | library/core/src/macros/panic.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/core/src/macros/panic.md b/library/core/src/macros/panic.md index 39fe9d8077e..e59be12a689 100644 --- a/library/core/src/macros/panic.md +++ b/library/core/src/macros/panic.md @@ -13,10 +13,11 @@ When using `panic!()` you can specify a string payload, that is built using the [`format!`] syntax. That payload is used when injecting the panic into the calling Rust thread, causing the thread to panic entirely. -The default `std` panic handling strategy is to print the message payload to -the `stderr` along with the file/line/column information of the `panic!()` +The behavior of the default `std` hook, i.e. the code, that runs directy +after the panic is invoked, is to print the message payload to the +`stderr` along with the file/line/column information of the `panic!()` call. You can override the panic hook using [`std::panic::set_hook()`]. -Inside the hook a panic can be reaped as the [`Box`]`<`[`Any`]`>` type, +Inside the hook a panic can be accessed as a `&dyn Any + Send`, which which contains either a `&str` or `String` for regular `panic!()` invocations. To panic with a value of another other type, [`panic_any`] can be used. |
