- 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)
19 lines
446 B
LLVM
19 lines
446 B
LLVM
; 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
|