Skip to content

Commit

Permalink
Merge pull request #256 from rust-lang/m-ou-se-patch-1
Browse files Browse the repository at this point in the history
Improve panic macro consistency summary
  • Loading branch information
nikomatsakis authored Jul 19, 2021
2 parents 0a0ad79 + b71362e commit 754f910
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rust-2021/panic-macro-consistency.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

## Summary

- `panic!(..)` now always use `format_args!(..)`, just like `println!()`.
- `panic!(..)` now always uses `format_args!(..)`, just like `println!()`.
- `panic!("{")` is no longer accepted, without escaping the `{` as `{{`.
- `panic!(x)` is no longer accepted if `x` is not a string literal.
- Use `std::panic::panic_any(x)` to panic with a non-string payload.
- Use `std::panic::panic_any(x)` to panic with a non-string payload.
- Or use `panic!("{}", x)` to use `x`'s `Display` implementation.
- The same applies to `assert!(expr, ..)`.

## Details

Expand Down

0 comments on commit 754f910

Please sign in to comment.