Closed
Description
Feature gate: #![feature(panic_any)]
This is a tracking issue for std::panic::panic_any
, a function to allow panicking with any value.
Context
Right now, it is possible to panic (that is, std::panic!
) on any value: panic!(123)
. This will be disallowed in Rust 2021, when panic!(..)
will always take a format string just like println!(..)
. At that point, this function will be the only way to panic without a (format) string. (See #80162 and rust-lang/rfcs#3007.)
Public API
mod std::panic {
/// Panic the current thread with the given message as the panic payload.
///
/// The message can be of any (`Any + Send`) type, not just strings.
///
/// The message is wrapped in a `Box<'static + Any + Send>`, which can be
/// accessed later using [`PanicInfo::payload`].
///
/// See the [`panic!`] macro for more information about panicking.
pub fn panic_any<M: Any + Send>(msg: M) -> !;
}
Steps / History
- Implementation: Add std::panic::panic_any. #74622
- Final commenting period (FCP)
- Stabilization PR: Stabilize std::panic::panic_any. #81194
Unresolved Questions
- None yet.
Metadata
Metadata
Assignees
Labels
Area: Error handlingArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs issues that are tracked on the team's project board.Relevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.