Skip to content

Commit

Permalink
Rollup merge of rust-lang#86074 - reaganmcf:iss-86039, r=jyn514
Browse files Browse the repository at this point in the history
Default panic message should print Box<dyn Any>

Closes rust-lang#86039

Prior to this patch, the panic message from running the following code would be `thread 'main' panicked at 'Box<Any>'...`
```rust
use std::panic::panic_any;
fn main() {
    panic_any(42);
}
```

This patch updates the phrasing to be more consistent. It now instead shows the following panic message:

```
thread 'main' panicked at 'Box<dyn Any>', ...
```

It's a very small fix 😄
  • Loading branch information
GuillaumeGomez committed Jun 7, 2021
2 parents b7ae6cd + 8330233 commit da99259
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library/std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ fn default_hook(info: &PanicInfo<'_>) {
Some(s) => *s,
None => match info.payload().downcast_ref::<String>() {
Some(s) => &s[..],
None => "Box<Any>",
None => "Box<dyn Any>",
},
};
let thread = thread_info::current_thread();
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/panics/panic-macro-any-wrapped.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-fail
// error-pattern:panicked at 'Box<Any>'
// error-pattern:panicked at 'Box<dyn Any>'
// ignore-emscripten no processes

#![allow(non_fmt_panic)]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/panics/panic-macro-any.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-fail
// error-pattern:panicked at 'Box<Any>'
// error-pattern:panicked at 'Box<dyn Any>'
// ignore-emscripten no processes

#![feature(box_syntax)]
Expand Down

0 comments on commit da99259

Please sign in to comment.