38 lines
747 B
LLVM
38 lines
747 B
LLVM
; Parent store through the lent exclusive borrow races after a handle handoff.
|
|
; expect: reject E4101
|
|
; phase: 3
|
|
; spec: docs/spec/04-concurrency-and-atomics.md §34
|
|
module test.cfg_provenance_loan_access
|
|
air 0
|
|
lang 0.1
|
|
features [cancellation, effects, ownership, tasks]
|
|
|
|
fn @main() -> u8
|
|
effects [task.spawn, task.wait]
|
|
entry:
|
|
%x = local.alloc u8
|
|
local.zero %x
|
|
%r = borrow.mut %x
|
|
%sc = task.scope.begin
|
|
%t = task.spawn %sc, @rd(%r)
|
|
br @next(%t)
|
|
next(%t2: task<u8>):
|
|
%one = const.u8 1
|
|
store %r, %one
|
|
%v = task.join %t2
|
|
borrow.end %r
|
|
task.scope.end %sc
|
|
ret %v
|
|
|
|
fn @rd(%p: mut<u8>) -> u8
|
|
effects []
|
|
entry:
|
|
%v = load %p
|
|
ret %v
|
|
|
|
fn @zero() -> u8
|
|
effects []
|
|
entry:
|
|
%z = const.u8 0
|
|
ret %z
|