- source bundle: a /docs directory with QUICK.md (Quick Reference plus a where-to-read table), language/*.md, diagnostics/errors.md and the AIR bundle only under air/; built from docs/agent/source-bundle.txt (> output files, @manifest includes) by zig build agent-reference - Quick Reference examples are checked: every aji block must be an excerpt of a conformance program in tests/conformance/source/quickref (zig build test fails otherwise); QR fixes found by the check (mut d = data, region not auto-borrowed, statement/borrow blocks that could not verify, io_error match) - frontend: task.*/channel.*/mutex.* are not-yet-implemented, not E7006 - aji lower --stats: mechanical_air_eliminated_raw and _normalized (each byte-string materialization counted as one constant; spec 15 §11) - harness: profile aji_source (doc_groups), per-file and per-group docs metrics on distinctive lines, profile columns (tool calls, lowered AIR raw/normalized, docs files read, IR-form and type-mismatch counts), dev-echo aji_source variant, scripted run and test, source token report - plan: P6A-8 done, P6A-9 criteria; Q-021/Q-022 resolved; unsafe block deferred
18 lines
491 B
Rust
18 lines
491 B
Rust
// Quick Reference §7: a mutex, a lock block and mutex.take (layer 8).
|
|
// expect: run
|
|
// result: 1
|
|
// phase: 6
|
|
// spec: docs/agent/quick-reference.md
|
|
module demo.qrmutex
|
|
|
|
fn main() -> u64
|
|
effects [task.wait]
|
|
{
|
|
let m = mutex.make(0u64);
|
|
lock ref m as count { // count: mut<u64>; unlocked at every exit of the block
|
|
*count = *count + 1;
|
|
} cancelled { trap; }
|
|
let total = mutex.take(move m); // needs no live borrow of m
|
|
total
|
|
}
|