Skip to content

Task.join_cleanup() on a Task parameter lowers as a byte copy; the param is never moved (validate-ownership: leak) #1990

Closed

Description

@ehartford

Spec: §14.7 (join_cleanup consumes the Task), §2.3 (transport is not duplication).

Repro (stage1 of fix-916 tip 4b2360f):

use std.task.Task
async fn one() -> i32: 1
fn finish(p: Task[i32]):
    p.cancel()
    p.join_cleanup()
fn main: finish(one())

with check repro.w --validate-ownership:

error: validate-ownership failed: fn finish bb3: owned local _1 is still Init at return — no path drops or moves it (a leak)

MIR: _3 = copy _1; then the join_cleanup call takes copy _3. The non-Copy Task is byte-copied into a temp and consumed from the copy; _1 is never moved or dropped. At run time the debug allocator reports no leak (the copy is consumed, _1 never dropped), but the MIR is wrong and every fixture using this idiom (da_916_cancel_unwinds_through_sync_callee.w's cancel_while_suspended) fails --validate-all.

Expected: join_cleanup on a place lowers as a move of that place (move _1), and the ownership validator passes.

Found while working on #1985/#1986 (branch wave-cancel). No workaround applied.

Activity

  1. 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