Skip to content

Commit 508e8a3

Browse files
authored
Unrolled build for #147086
Rollup merge of #147086 - Zalathar:payload, r=jieyouxu compiletest: Use `PanicHookInfo::payload_as_str` now that it's stable in beta Nice little FIXME cleanup after the bootstrap beta bump to 1.91 in #146636. r? jieyouxu
2 parents 4ffeda1 + d8a1edc commit 508e8a3

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

src/tools/compiletest/src/panic_hook.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn custom_panic_hook(default_hook: &PanicHook, info: &panic::PanicHookInfo<'_>)
4242

4343
let thread = thread::current().name().unwrap_or("(test runner)").to_owned();
4444
let location = get_location(info);
45-
let payload = payload_as_str(info).unwrap_or("Box<dyn Any>");
45+
let payload = info.payload_as_str().unwrap_or("Box<dyn Any>");
4646
let backtrace = Backtrace::capture();
4747

4848
writeln!(out, "\nthread '{thread}' panicked at {location}:\n{payload}").unwrap();
@@ -72,19 +72,6 @@ fn get_location<'a>(info: &'a PanicHookInfo<'_>) -> &'a dyn Display {
7272
}
7373
}
7474

75-
/// FIXME(Zalathar): Replace with `PanicHookInfo::payload_as_str` when that's
76-
/// stable in beta.
77-
fn payload_as_str<'a>(info: &'a PanicHookInfo<'_>) -> Option<&'a str> {
78-
let payload = info.payload();
79-
if let Some(s) = payload.downcast_ref::<&str>() {
80-
Some(s)
81-
} else if let Some(s) = payload.downcast_ref::<String>() {
82-
Some(s)
83-
} else {
84-
None
85-
}
86-
}
87-
8875
fn rust_backtrace_full() -> bool {
8976
static RUST_BACKTRACE_FULL: LazyLock<bool> =
9077
LazyLock::new(|| matches!(env::var("RUST_BACKTRACE").as_deref(), Ok("full")));

0 commit comments

Comments
 (0)