diag: add factual related borrow and task locations
This commit is contained in:
1 parent
dbd9763713
commit
8ee0f4c2bf
27 files changed
+659
-18
No files matched your search
@@ -0,0 +1,32 @@
|
||||
; expect: reject E4302
|
||||
; phase: 3
|
||||
; spec: docs/spec/10-diagnostics-and-agent-protocol.md §2
|
||||
module related.cancel_twice
|
||||
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.ref %x
|
||||
%s = task.scope.begin
|
||||
%t = task.spawn %s, @worker(%r)
|
||||
task.join.cancel %t, ok -> @joined, cancelled -> @retry
|
||||
retry(%back: task<u8>):
|
||||
task.join.cancel %back, ok -> @joined, cancelled -> @cancelled
|
||||
joined(%v: u8):
|
||||
task.scope.end %s
|
||||
borrow.end %r
|
||||
ret %v
|
||||
cancelled(%back2: task<u8>):
|
||||
borrow.end %r
|
||||
%v2 = task.join %back2
|
||||
task.scope.end %s
|
||||
ret %v2
|
||||
fn @worker(%p: ref<u8>) -> u8
|
||||
effects []
|
||||
entry:
|
||||
%v = load %p
|
||||
ret %v
|
||||
@@ -0,0 +1,34 @@
|
||||
; expect: run
|
||||
; result: 0
|
||||
; schedules: 20
|
||||
; phase: 3
|
||||
; spec: docs/spec/04-concurrency-and-atomics.md §34
|
||||
module related.cancel_twice_joined
|
||||
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.ref %x
|
||||
%s = task.scope.begin
|
||||
%t = task.spawn %s, @worker(%r)
|
||||
task.join.cancel %t, ok -> @joined, cancelled -> @retry
|
||||
retry(%back: task<u8>):
|
||||
task.join.cancel %back, ok -> @joined, cancelled -> @cancelled
|
||||
joined(%v: u8):
|
||||
task.scope.end %s
|
||||
borrow.end %r
|
||||
ret %v
|
||||
cancelled(%back2: task<u8>):
|
||||
%v2 = task.join %back2
|
||||
borrow.end %r
|
||||
task.scope.end %s
|
||||
ret %v2
|
||||
fn @worker(%p: ref<u8>) -> u8
|
||||
effects []
|
||||
entry:
|
||||
%v = load %p
|
||||
ret %v
|
||||
Reference in new issue
Block a user