about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-06-08 13:26:31 +0900
committerGitHub <noreply@github.com>2021-06-08 13:26:31 +0900
commitb7d05f816547a780622046cb716dfdb401fee93c (patch)
tree90bcdbde3dcef4ae4401fce95a7a82e7d0a00e7e
parentc3028101a22b8f67457221267e7f35dfd8a15c0d (diff)
parent8330233ba751778f8571c8879f85612fd2d9fb9a (diff)
downloadrust-b7d05f816547a780622046cb716dfdb401fee93c.tar.gz
rust-b7d05f816547a780622046cb716dfdb401fee93c.zip
Rollup merge of #86074 - reaganmcf:iss-86039, r=jyn514
Default panic message should print Box<dyn Any>

Closes #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 😄
-rw-r--r--library/std/src/panicking.rs2
-rw-r--r--src/test/ui/panics/panic-macro-any-wrapped.rs2
-rw-r--r--src/test/ui/panics/panic-macro-any.rs2
3 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index 02957e75a74..e591e073e7b 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -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();
diff --git a/src/test/ui/panics/panic-macro-any-wrapped.rs b/src/test/ui/panics/panic-macro-any-wrapped.rs
index 95ae6ffe8be..100ac10c767 100644
--- a/src/test/ui/panics/panic-macro-any-wrapped.rs
+++ b/src/test/ui/panics/panic-macro-any-wrapped.rs
@@ -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)]
diff --git a/src/test/ui/panics/panic-macro-any.rs b/src/test/ui/panics/panic-macro-any.rs
index d2a7ba3713a..a5ba30220e8 100644
--- a/src/test/ui/panics/panic-macro-any.rs
+++ b/src/test/ui/panics/panic-macro-any.rs
@@ -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)]