Open and answer this issue on GitHub.
ready · opened 2026-12-01 · updated 2026-12-01 · 0 comments
Found while clarifying #3011 (async D20). A struct with a task::ChildHandle field passes the check, and then rustc fails on the lowered code: “struct takes 2 generic arguments”. The field is lowered with the wrong arity.
Probe:
struct Node { next: SharedMut[Node]?, h: task::ChildHandle[i64]? }
fn main() throws {
async {
let a = SharedMut(Node { next: null, h: async(handle) fn { 1 } })
let b = SharedMut(Node { next: a, h: null })
a.update(fn(mut v) { v.next = b })
}
print(1)
}
(Once NK2122 looks through containers, this probe should be refused there. That fix is “NK2122 misses a child handle inside a container” (#3023). The arity defect still needs fixing for a field that is allowed.)
To build
task::ChildHandle[T] in a field writes the generic arguments the runtime type takes..nika test with a ChildHandle field that may legally live in a struct within its group.Done when that test compiles and runs.
Generated by Claude Code