; A guard may be passed through a block argument; borrowing through it, unlocking and only then ending the mutex borrow is valid. ; expect: run ; schedules: 20 ; result: 7 ; phase: 3 ; spec: docs/spec/04-concurrency-and-atomics.md ยง40 module test.cfg_provenance_guard_handoff air 0 lang 0.1 features [cancellation, effects, ownership, sync, tasks] fn @main() -> u64 effects [task.wait] entry: %z = const.u64 0 %m = mutex.make %z %mr = borrow.ref %m mutex.lock %mr, ok -> @locked, cancelled -> @out locked(%g: guard): br @next(%g) next(%g2: guard): %p = mutex.borrow %g2 %seven = const.u64 7 store %p, %seven borrow.end %p mutex.unlock %g2 borrow.end %mr %v = mutex.take %m ret %v out: borrow.end %mr %w = mutex.take %m ret %w