Skip to content

Rollup of 8 pull requests #81674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 28 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8afe598
Add big-endian support for AArch64 va_arg
Jan 20, 2021
d53b0a0
Fix ARM and AArch64 calling convention for passing small composite types
Jan 20, 2021
06f14df
Support AArch64 ILP32 in libunwind bindings
Jan 20, 2021
a112c4d
Support AArch64 big-endian and ILP32 in compiletest
Jan 20, 2021
8783d1a
Add big-endian and ILP32 AArch64 targets
Jan 20, 2021
69e6326
Add new aarch64 targets to platform-support.md
Jan 26, 2021
5307230
Bump LLVM submodule
Jan 21, 2021
4b64bc1
Upgrade Chalk
jackh726 Jan 1, 2021
b35d601
Directly use `Option<&[T]>` instead of converting from `Option<&Vec<T…
LingMan Feb 1, 2021
6f90365
Add lint for `panic!(123)` which is not accepted in Rust 2021.
m-ou-se Feb 1, 2021
91a9866
Make panic/assert calls in rustc compatible with Rust 2021.
m-ou-se Feb 1, 2021
c3dedd0
Upgrade libc to 0.2.85
Jan 21, 2021
3408c58
Fix AArch64 types in std::os::raw
Amanieu Feb 1, 2021
bad0f28
Improve wording of suggestion about accessing field
hkmatsumoto Feb 2, 2021
535f487
Allow/fix non_fmt_panic in tests.
m-ou-se Feb 1, 2021
717355d
Update panic!() documentation about non-string panics.
m-ou-se Feb 2, 2021
07c4eeb
Fix out of date `Scalar` documentation
jacob-hughes Feb 2, 2021
6525671
Add better diagnostic for missing where clause
JulianKnodt Jan 30, 2021
ae3164e
Add .editorconfig
vn971 Jan 22, 2021
a0622d6
Update Chalk
jackh726 Jan 31, 2021
9cbd231
Rollup merge of #80593 - jackh726:chalk-upgrade, r=nikomatsakis
m-ou-se Feb 2, 2021
aed63da
Rollup merge of #81260 - vn971:restore-editorconfig, r=Mark-Simulacrum
m-ou-se Feb 2, 2021
a262bc1
Rollup merge of #81455 - Amanieu:aarch64_ilp32, r=sanxiyn
m-ou-se Feb 2, 2021
7fa357d
Rollup merge of #81544 - JulianKnodt:sat_where, r=lcnr
m-ou-se Feb 2, 2021
2a41f20
Rollup merge of #81636 - LingMan:slice_not_vec, r=petrochenkov
m-ou-se Feb 2, 2021
132f55c
Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank
m-ou-se Feb 2, 2021
0513708
Rollup merge of #81655 - matsujika:suggest-accessing-field-rewording,…
m-ou-se Feb 2, 2021
ddf8dc7
Rollup merge of #81665 - jacob-hughes:mir_doc_fix, r=estebank
m-ou-se Feb 2, 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
Update panic!() documentation about non-string panics.
  • Loading branch information
m-ou-se committed Feb 2, 2021
commit 717355d03c46bf27d15783b50199250ac5e62f2c
15 changes: 8 additions & 7 deletions library/core/src/macros/panic.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ tests. `panic!` is closely tied with the `unwrap` method of both
`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. Each thread's panic can be reaped as the [`Box`]`<`[`Any`]`>` type,
and the single-argument form of the `panic!` macro will be the value which
is transmitted.
panic entirely. This macro panics with a string and uses the [`format!`] syntax
for building the message.

Each thread's 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.

[`Result`] enum is often a better solution for recovering from errors than
using the `panic!` macro. This macro should be used to avoid proceeding using
incorrect values, such as from external sources. Detailed information about
error handling is found in the [book].

The multi-argument form of this macro panics with a string and has the
[`format!`] syntax for building a string.

See also the macro [`compile_error!`], for raising errors during compilation.

[ounwrap]: Option::unwrap
[runwrap]: Result::unwrap
[`panic_any`]: ../std/panic/fn.panic_any.html
[`Box`]: ../std/boxed/struct.Box.html
[`Any`]: crate::any::Any
[`format!`]: ../std/macro.format.html
Expand All @@ -42,6 +43,6 @@ program with code `101`.
# #![allow(unreachable_code)]
panic!();
panic!("this is a terrible mistake!");
panic!(4); // panic with the value of 4 to be collected elsewhere
panic!("this is a {} {message}", "fancy", message = "message");
std::panic::panic_any(4); // panic with the value of 4 to be collected elsewhere
```