; A region is not Share: lending ref to a task is rejected. ; expect: reject E4002 ; phase: 3 ; spec: docs/spec/04-concurrency-and-atomics.md module test.tasks_not_share air 0 lang 0.1 features [capabilities, effects, heap, ownership, regions, resources, tasks] fn @main(%heap: cap) -> void effects [task.spawn, mem.alloc] entry: region.create %heap, ok -> @have, err -> @nomem have(%reg: region): %rb = borrow.ref %reg %sc = task.scope.begin %t = task.spawn %sc, @peek(%rb) task.join %t task.scope.end %sc borrow.end %rb region.destroy %reg ret nomem(%e: alloc_error): trap fn @peek(%r: ref) -> void effects [] entry: ret