-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Use Display
in top-level example for PanicInfo
#110110
Conversation
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Great, thank you! |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#108687 (Reformulate `point_at_expr_source_of_inferred_type` to be more accurate) - rust-lang#109272 (Add Command environment variable inheritance docs) - rust-lang#109947 (Add links from `core::cmp` derives to their traits) - rust-lang#110110 (Use `Display` in top-level example for `PanicInfo`) - rust-lang#110154 (Fix typos in library) - rust-lang#110244 (Remove some unneeded imports / qualified paths) - rust-lang#110328 ([rustdoc] Add explanations for auto-disambiguation when an intra doc link is resolved to a proc-macro and a trait at the same time) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Addresses #110098.
This confused me as well, when I was writing a
no_std
panic handler for the first time, so here's a better top-level example.Display
is stable, prints the.message()
if available, and falls back to.payload().downcast_ref<&str>()
if the message is not available. So this example should provide strictly more information and also work for formatted panics.The old example still exists on the
payload
method.