Skip to content

Commit

Permalink
Remove core::panic::PanicInfo::internal_constructor.
Browse files Browse the repository at this point in the history
It no longer needs to be public.
  • Loading branch information
m-ou-se committed Jun 11, 2024
1 parent cca865d commit 701d6a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
8 changes: 1 addition & 7 deletions core/src/panic/panic_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,8 @@ pub struct PanicInfo<'a> {
}

impl<'a> PanicInfo<'a> {
#[unstable(
feature = "panic_internals",
reason = "internal details of the implementation of the `panic!` and related macros",
issue = "none"
)]
#[doc(hidden)]
#[inline]
pub fn internal_constructor(
pub(crate) fn new(
message: fmt::Arguments<'a>,
location: &'a Location<'a>,
can_unwind: bool,
Expand Down
10 changes: 3 additions & 7 deletions core/src/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub const fn panic_fmt(fmt: fmt::Arguments<'_>) -> ! {
fn panic_impl(pi: &PanicInfo<'_>) -> !;
}

let pi = PanicInfo::internal_constructor(
let pi = PanicInfo::new(
fmt,
Location::caller(),
/* can_unwind */ true,
Expand Down Expand Up @@ -101,12 +101,8 @@ pub const fn panic_nounwind_fmt(fmt: fmt::Arguments<'_>, force_no_backtrace: boo
}

// PanicInfo with the `can_unwind` flag set to false forces an abort.
let pi = PanicInfo::internal_constructor(
&fmt,
Location::caller(),
/* can_unwind */ false,
force_no_backtrace,
);
let pi =
PanicInfo::new(fmt, Location::caller(), /* can_unwind */ false, force_no_backtrace);

// SAFETY: `panic_impl` is defined in safe Rust code and thus is safe to call.
unsafe { panic_impl(&pi) }
Expand Down

0 comments on commit 701d6a2

Please sign in to comment.