Skip to content

Commit 754f910

Browse files
authored
Merge pull request #256 from rust-lang/m-ou-se-patch-1
Improve panic macro consistency summary
2 parents 0a0ad79 + b71362e commit 754f910

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/rust-2021/panic-macro-consistency.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
## Summary
44

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

1012
## Details
1113

0 commit comments

Comments
 (0)