Skip to content

Cancellation: a call through a closure, dyn method or fn value that ends in a sync fn that may suspend gets no cancelled-return check (#916 class) #1985

Closed

Description

@ehartford

Remaining after #916's fix (fix-916, f14fcb3): MIR now gives a call to a function Sema says may suspend the same cancelled-return check an await gets — but only when MIR can see the callee function. A call through a closure value, a dyn method, or a function value whose target is a sync function that suspends still has no check, so a cancelled caller runs past it and may drop the never-written return value (the #916 invalid free). Sema owns the fact (D65): the callable's type must carry may-suspend (a function type / closure / trait method that may suspend), so the indirect call site can be checked. Failing-first: the #916 debug-alloc fixture shape (da_916_cancel_unwinds_through_sync_callee.w) through each of the three indirections.

Activity

  1. added
    bug
    on Oct 3, 2026
  2. ehartford commented on Oct 4, 2026

    @ehartford
    ContributorAuthor

    Fixed on main in 8cc883a (stack #2072, ten PRs; seed-driven battery GREEN on 92add22, tree identical to main).

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions