Skip to content

Tracking Issue for panic_any #78500

Closed
Closed
@m-ou-se

Description

@m-ou-se

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

Unresolved Questions

  • None yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-error-handlingArea: Error handlingA-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions