Skip to content

Cancellation inside a defer while break/continue is unwinding nested scopes may re-drop locals already dropped on that path (untested) #1986

Closed

Description

@ehartford

Found reasoning through #916's fix (fix-916): when a cancellation lands inside a defer body while a break/continue is already running cleanup for nested scopes, the cancelled-return unwind re-emits drops for every scheduled local, including ones that path may already have dropped. Untested — first write the fixture (a loop with a nested scope holding a Drop value, a defer that awaits, cancellation delivered at that await during a break) under run --debug-alloc + WITH_ALLOC_NO_REUSE=1; if it double-frees, fix the unwind to emit only drops still pending on that path (MIR's path-sensitive drop state owns this, D65); if it doesn't, keep the fixture as the pin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions