Skip to content

Document guarantees around drop and panicing #348

Description

@RalfJung

Currently, when a panic occurs during a regular (i.e., non-unwinding) drop of a local variable, the remaining local variables are still going to have their drop called as usual: https://play.rust-lang.org/?gist=1e2b47513bbfebb71cb6d4e05eca822d&version=stable&mode=debug

Furthermore, if a panic occurs during the drop of a struct with members, the member's drop is also still going to be executed: https://play.rust-lang.org/?gist=69c5e0e922f96dbdc939dad6453ecc6c&version=stable&mode=debug

It would be nice to have such guarantees spelled out explicitly somewhere. Given that this is externally visible behavior, it is probably covered by the stability guarantee, but still -- these guarantees will be really important for providing safe stack pinning APIs.

I am not sure what would be a good place for this to be documented, maybe somewhere in https://doc.rust-lang.org/stable/reference/?

Cc @pythonesque

(Moved here from rust-lang/rust#50765)

Activity

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

Metadata

Metadata

Assignees

Labels

New ContentMissing features or aspects of language not currently documented.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions