; The cancelled handle of task.join.cancel may travel through an ordinary block argument; joining it before ending the lent borrow is valid. ; expect: run ; schedules: 20 ; result: 5 ; phase: 3 ; spec: docs/spec/04-concurrency-and-atomics.md ยง37 module test.cfg_provenance_cancel_arg air 0 lang 0.1 features [cancellation, effects, ownership, tasks] fn @main() -> u8 effects [task.spawn, task.wait] entry: %x = local.alloc u8 %five = const.u8 5 local.store %x, %five %r = borrow.ref %x %sc = task.scope.begin %t = task.spawn %sc, @rd(%r) task.join.cancel %t, ok -> @joined, cancelled -> @cancelled joined(%v: u8): task.scope.end %sc borrow.end %r ret %v cancelled(%t1: task): br @handle(%t1) handle(%t2: task): %v2 = task.join %t2 task.scope.end %sc borrow.end %r ret %v2 fn @rd(%p: ref) -> u8 effects [] entry: %v = load %p ret %v