Skip to content

Enum destructors don't get run while unwinding #26655

Closed
@arielb1

Description

@arielb1
enum E { Foo }

impl Drop for E {
    fn drop(&mut self) {
        println!("Dropping");
    }
}

fn main() {
    let e = E::Foo;

    let o = 0;
    1/o;
}

Notice that Dropping won't get printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions