verifier: preserve resource obligations across CFG handoff

This commit is contained in:
dev committed 2026-10-08 17:17:08 +03:00
1 parent 0e98638bc6
commit 09fbf8a5bc
34 files changed
+1267 -67

No files matched your search

@@ -0,0 +1,41 @@
; One predecessor lends the borrow to its task and the other does not; after the join the handle may hold the loan, so ending the borrow first is rejected.
; expect: reject E4302
; phase: 3
; spec: docs/spec/04-concurrency-and-atomics.md §34
module test.cfg_provenance_loan_join
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
%sc = task.scope.begin
%c = const.bool true
cbr %c, @lend(), @plain()
lend:
%t1 = task.spawn %sc, @rd(%r)
br @joined(%t1)
plain:
%t2 = task.spawn %sc, @zero()
br @joined(%t2)
joined(%t: task<u8>):
borrow.end %r
%v = task.join %t
task.scope.end %sc
ret %v
fn @rd(%p: ref<u8>) -> u8
effects []
entry:
%v = load %p
ret %v
fn @zero() -> u8
effects []
entry:
%z = const.u8 0
ret %z