Skip to content

Very confusing error message when panicking during a panic #114954

Description

@SUPERCILEX

I tried this code:

struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {
        panic!("drop");
    }
}

fn main() {
    let f = Foo;
    panic!("main");
}
9  | / fn main() {
10 | |     let f = Foo;
11 | |     panic!("main");
12 | | }
   | |_^ panic in a function that cannot unwind

Clearly the function panics so the error message doesn't make much sense. I believe it's saying that while panicking, the function is placed into a context in which nested panics are disallowed. Perhaps the message could include a hint that says something like Possibly caused by nested panics from a drop function.

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-panicArea: Panicking machineryC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions