Phase 3: owner decisions on RFC 0012 implementation

- spec 04 §40: mutex<T> always linear, never copyable; mutex.take is the
  only way to dismantle it and needs no live borrow (hence no guard and
  no waiter); no unlock or destructor
- P3-10 (async buffer claims, E4303) moved to P7-10 with task-aware
  I/O; E4303 stays reserved; Phase 3 scope closed
- RFC 0012 erratum: consumption after send is E2002, use is E2001
- tests: take while borrowed (E2101), use after take (E3001)
This commit is contained in:
dev committed 2026-10-04 16:57:59 +03:00
1 parent aaf32b6853
commit 929132c81d
8 files changed
+50 -8

No files matched your search

@@ -0,0 +1,18 @@
; mutex.take needs no live borrow of the mutex, so no guard or waiter can exist.
; expect: reject E2101
; phase: 3
; spec: docs/spec/04-concurrency-and-atomics.md
module test.sync_take_while_borrowed
air 0
lang 0.1
features [cancellation, effects, ownership, sync, tasks]
fn @f() -> u64
effects []
entry:
%z = const.u64 0
%m = mutex.make %z
%mr = borrow.ref %m
%v = mutex.take %m
borrow.end %mr
ret %v
@@ -0,0 +1,18 @@
; After mutex.take the mutex is dead: borrowing it again is a use after consumption (as after own.take).
; expect: reject E3001
; phase: 3
; spec: docs/spec/04-concurrency-and-atomics.md
module test.sync_use_after_take
air 0
lang 0.1
features [cancellation, effects, ownership, sync, tasks]
fn @f() -> u64
effects []
entry:
%z = const.u64 0
%m = mutex.make %z
%v = mutex.take %m
%mr = borrow.ref %m
borrow.end %mr
ret %v