Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
12d6238
Add `as_str` method for split whitespace str iterators
WaffleLapkin Feb 26, 2021
d4fd853
Change formatting of safety comment
WaffleLapkin Feb 26, 2021
c07955c
Fix overflowing length in Vec<ZST> to VecDeque
cuviper Mar 17, 2021
55d9e0f
Include output stream in `panic!()` documentation
jfrimmel Mar 18, 2021
61e5d54
Add more information about panicking
jfrimmel Mar 18, 2021
d5e45b5
Incorporate review feedback #2
jfrimmel Mar 18, 2021
1e322e3
Revert the second deprecation of collections::Bound
bstrie Mar 18, 2021
19bd066
Apply suggestions from code review
jfrimmel Mar 18, 2021
1c8c261
Update LLVM to bring in SIMD updates for WebAssembly
alexcrichton Mar 18, 2021
778e197
Mark early otherwise optimization unsound
spastorino Mar 18, 2021
430c0d1
Do not ICE on ty::Error as an error must already have been reported
oli-obk Mar 19, 2021
9577058
Add a second regression test
oli-obk Mar 19, 2021
1491496
Only build help popup when it's really needed
GuillaumeGomez Dec 12, 2020
e2c70f7
Ignore main.js file length
GuillaumeGomez Mar 19, 2021
ae1a2df
Rollup merge of #79986 - GuillaumeGomez:build-help-when-needed, r=Nem…
Dylan-DPC Mar 19, 2021
f7febc8
Rollup merge of #82570 - WaffleLapkin:split_whitespace_as_str, r=m-ou-se
Dylan-DPC Mar 19, 2021
1a0e32f
Rollup merge of #83244 - cuviper:vec_deque-zst, r=m-ou-se
Dylan-DPC Mar 19, 2021
2cc5d72
Rollup merge of #83254 - jfrimmel:panic_output-stream, r=m-ou-se,josh…
Dylan-DPC Mar 19, 2021
dbf589f
Rollup merge of #83269 - bstrie:revertdep, r=m-ou-se
Dylan-DPC Mar 19, 2021
90e52a1
Rollup merge of #83277 - spastorino:early_otherwise-opt-unsound, r=ol…
Dylan-DPC Mar 19, 2021
767b094
Rollup merge of #83285 - alexcrichton:wasm-simd-update, r=cuviper
Dylan-DPC Mar 19, 2021
51a29cb
Rollup merge of #83297 - oli-obk:why_bug_today_if_you_can_delay_to_to…
Dylan-DPC Mar 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more information about panicking
This includes the description of the default `std` behavior and mentions
the `panic::set_hook()` function.
  • Loading branch information
jfrimmel committed Mar 18, 2021
commit 61e5d549b49152b5fdc714fde93ab5c55e301127
14 changes: 9 additions & 5 deletions library/core/src/macros/panic.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ tests. `panic!` is closely tied with the `unwrap` method of both
[`Option`][ounwrap] and [`Result`][runwrap] enums. Both implementations call
`panic!` when they are set to [`None`] or [`Err`] variants.

This macro is used to inject panic into a Rust thread, causing the thread to
panic entirely. The string built by this macro (using the [`format!`] syntax
for building the actual message) is printed to `stderr`.

Each thread's panic can be reaped as the [`Box`]`<`[`Any`]`>` type,
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!()`
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,
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.

Expand All @@ -26,6 +29,7 @@ See also the macro [`compile_error!`], for raising errors during compilation.

[ounwrap]: Option::unwrap
[runwrap]: Result::unwrap
[`std::panic::set_hook()`]: ../std/panic/fn.set_hook.html
[`panic_any`]: ../std/panic/fn.panic_any.html
[`Box`]: ../std/boxed/struct.Box.html
[`Any`]: crate::any::Any
Expand Down