Skip to content

validate-all: select and tuple-await lowering move a Task handle then read it; tuple-await unwind never releases the other tasks; use after .await vs spec #2011

Closed

Description

@ehartford

Exposed by the #1993 validator rule (wave-cancel, bf1b6f6: mir_read_of_moved_owned_local rejects a read of a non-Copy owned local every path already moved out). lower_single_await was fixed in the same commit (29 → 10 verdicts over the async/cancel/defer corpus). The remaining reds under with check <file> --validate-all (all pass at run time; the battery does not run validate-all over these corpora):

1. select lowering (MirLower select arms, the second FIBER_AWAIT site) moves the task into the select intrinsic (call (move _2, move _4)), again into the winner's FIBER_AWAIT (move _2, const 1), and into both the loser's cancel and cleanup await (move _2, move _2). Same discipline as lower_single_await should apply: observe with copy, take once per path.

  • test/behavior/behav_async_cancel.w, behav_async_cancel_nested_unwind.w, behav_async_inferred_task_type.w, behav_async_select_cancels_parked_recv.w, behav_async_select_cancels_parked_send.w, behav_async_select_completed_loser_await.w, test/debug_alloc/da_async_cancel_drops_live.w

2. tuple await unwind leaks the other tasks (test/spec/spec_ss14_async_await.w parallel_tuple_await): (left_task, right_task).await — on self-cancel during the left await the unwind cancels and cleans up _1 and reaches StorageDead(_3) with the right task never cancelled or joined: "owned local _3 is still Init at return". Previously masked by the first verdict on the file.

3. Use after .await: spec vs pinned test. §22 (concurrency.md, ephemeral example): t.await // OK: consumes the task. test/spec/spec_ss14_7_task_is_done.w (#637) pins assert(t2.await == 2); assert(t2.is_done()), and spec_ss14_7_task_was_cancelled.w reads the task after awaiting it; Sema accepts both, so the MIR reads _22 after the await's _28 = move _22. Either Sema rejects a use after .await (spec as written; the tests change) or .await observes and the spec sentence changes — needs a ruling.

Also red under validate-all in that corpus, other rules, not from #1993: errdefer_basic/ordering/question_mark ("reset of _3 on a path where it was never moved"), da_gen_push_pipeline_stages (drop after move), spec_ss07_3a_implicit_context (copy into consuming param), spec_ss14_22_task_ephemerality (MIR lowering failed).

Activity

  1. 1 remaining item

  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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions