Skip to content

Commit

Permalink
Use unnamed lifetimes for [..]Payload impl blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Jun 11, 2024
1 parent cf984e0 commit 224d45c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions std/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,11 +597,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
string: Option<String>,
}

impl<'a> FormatStringPayload<'a> {
fn new(inner: &'a fmt::Arguments<'a>) -> Self {
Self { inner, string: None }
}

impl FormatStringPayload<'_> {
fn fill(&mut self) -> &mut String {
use crate::fmt::Write;

Expand All @@ -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) {
// 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
Expand Down Expand Up @@ -654,7 +650,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
);
} else {
rust_panic_with_hook(
&mut FormatStringPayload::new(&msg),
&mut FormatStringPayload { inner: &msg, string: None },
Some(msg),
loc,
info.can_unwind(),
Expand Down

0 comments on commit 224d45c

Please sign in to comment.