; atomic.take while the cell is lent to a live task is a race (spec 04 ยง28). ; expect: reject E4101 ; phase: 5 ; spec: docs/spec/04-concurrency-and-atomics.md module test.take_while_lent air 0 lang 0.1 features [atomics, cancellation, effects, ownership, tasks] fn @reader(%c: ref>) -> u64 effects [atomic] entry: %x = atomic.load.seq_cst %c ret %x fn @main() -> u64 effects [atomic, task.spawn, task.wait] entry: %z = const.u64 0 %c = atomic.new %z %r = borrow.ref %c %s = task.scope.begin %t = task.spawn %s, @reader(%r) %v = atomic.take %c %x = task.join %t task.scope.end %s borrow.end %r ret %v