1
Fork 0

Use unnamed lifetimes for [..]Payload impl blocks.

This commit is contained in:
Mara Bos 2023-10-02 14:16:10 +02:00
parent 4e356f3184
commit 22f7399b32

View file

@ -597,11 +597,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
string: Option<String>, string: Option<String>,
} }
impl<'a> FormatStringPayload<'a> { impl FormatStringPayload<'_> {
fn new(inner: &'a fmt::Arguments<'a>) -> Self {
Self { inner, string: None }
}
fn fill(&mut self) -> &mut String { fn fill(&mut self) -> &mut String {
use crate::fmt::Write; use crate::fmt::Write;
@ -615,7 +611,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
} }
} }
unsafe impl<'a> PanicPayload for FormatStringPayload<'a> { unsafe impl PanicPayload for FormatStringPayload<'_> {
fn take_box(&mut self) -> *mut (dyn Any + Send) { fn take_box(&mut self) -> *mut (dyn Any + Send) {
// We do two allocations here, unfortunately. But (a) they're required with the current // We do two allocations here, unfortunately. But (a) they're required with the current
// scheme, and (b) we don't handle panic + OOM properly anyway (see comment in // scheme, and (b) we don't handle panic + OOM properly anyway (see comment in
@ -654,7 +650,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
); );
} else { } else {
rust_panic_with_hook( rust_panic_with_hook(
&mut FormatStringPayload::new(&msg), &mut FormatStringPayload { inner: &msg, string: None },
Some(msg), Some(msg),
loc, loc,
info.can_unwind(), info.can_unwind(),