Skip to content

Stabilize PanicInfo::message() and PanicMessage #126732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/core/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::any::Any;
pub use self::location::Location;
#[stable(feature = "panic_hooks", since = "1.10.0")]
pub use self::panic_info::PanicInfo;
#[unstable(feature = "panic_info_message", issue = "66745")]
#[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")]
pub use self::panic_info::PanicMessage;
#[stable(feature = "catch_unwind", since = "1.9.0")]
pub use self::unwind_safe::{AssertUnwindSafe, RefUnwindSafe, UnwindSafe};
Expand Down
10 changes: 5 additions & 5 deletions library/core/src/panic/panic_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub struct PanicInfo<'a> {
/// that were given to the `panic!()` macro.
///
/// See [`PanicInfo::message`].
#[unstable(feature = "panic_info_message", issue = "66745")]
#[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")]
pub struct PanicMessage<'a> {
message: fmt::Arguments<'a>,
}
Expand Down Expand Up @@ -57,7 +57,7 @@ impl<'a> PanicInfo<'a> {
/// }
/// ```
#[must_use]
#[unstable(feature = "panic_info_message", issue = "66745")]
#[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")]
pub fn message(&self) -> PanicMessage<'_> {
PanicMessage { message: self.message }
}
Expand Down Expand Up @@ -164,7 +164,7 @@ impl<'a> PanicMessage<'a> {
/// For most cases with placeholders, this function will return `None`.
///
/// See [`fmt::Arguments::as_str`] for details.
#[unstable(feature = "panic_info_message", issue = "66745")]
#[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_arguments_as_str", issue = "103900")]
#[must_use]
#[inline]
Expand All @@ -173,15 +173,15 @@ impl<'a> PanicMessage<'a> {
}
}

#[unstable(feature = "panic_info_message", issue = "66745")]
#[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")]
impl Display for PanicMessage<'_> {
#[inline]
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
formatter.write_fmt(self.message)
}
}

#[unstable(feature = "panic_info_message", issue = "66745")]
#[stable(feature = "panic_info_message", since = "CURRENT_RUSTC_VERSION")]
impl fmt::Debug for PanicMessage<'_> {
#[inline]
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
1 change: 0 additions & 1 deletion library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@
#![feature(maybe_uninit_uninit_array)]
#![feature(maybe_uninit_write_slice)]
#![feature(panic_can_unwind)]
#![feature(panic_info_message)]
#![feature(panic_internals)]
#![feature(pointer_is_aligned_to)]
#![feature(portable_simd)]
Expand Down
1 change: 0 additions & 1 deletion tests/run-make/wasm-exceptions-nostd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(link_llvm_intrinsics)]
#![feature(panic_info_message)]

extern crate alloc;

Expand Down
Loading