cli: preserve whole-array arguments for explicit array parameters

This commit is contained in:
dev committed 2026-10-07 22:29:45 +03:00
1 parent f733f7c7bb
commit dde801c653
44 files changed
+397 -9

No files matched your search

+2
View File
@@ -152,3 +152,5 @@ RFC 0037 related positions (cl100k): Quick Reference 8,807 → 8,859 (+52), othe
DD-019 unique diagnostic fields (cl100k): Quick Reference stays 8,859; other source docs 66,195 → 66,312 (+117), full source 75,054 → 75,171 (+0.16%). o200k groups are 8,895 / 66,517 / 75,412; Qwen2.5 9,135 / 67,933 / 77,068. AIR grows 47,328 → 47,445 (+117, +0.25%), 184,060 → 184,628 bytes; library/std.md is unchanged. Explicit payload names preserve the stable envelope and both guard/borrow identities. No language concept, syntax, code, verifier/runtime state or repair application is added; clients that previously read a capability payload as `kind` use `capability_kind`. No empirical MCC benefit is claimed.
Q-041 source scope names (DD-020, cl100k): Quick Reference 8,859 → 8,889 (+30), other source docs 66,312 → 66,484 (+172), full source 75,171 → 75,373 (+0.27%). o200k groups are 8,925 / 66,690 / 75,615; Qwen2.5 9,167 / 68,115 / 77,282. AIR remains 184,628 bytes / 47,445 cl100k tokens; library/std.md is unchanged. One existing lexical block identifier is explicitly excluded from ordinary value expressions, removing ineffective transfers and misleading repair hints. There is no new syntax, diagnostic code/reason, verifier/runtime state or feature. Former source aliases now reject; ordinary shadowing and AIR scope flow remain available. No empirical MCC benefit is claimed.
Q-023 whole-array arguments (DD-021, cl100k): Quick Reference 8,889 → 8,948 (+59), other source docs 66,484 → 66,669 (+185), full source 75,373 → 75,617 (+0.32%). o200k groups are 8,984 / 66,873 / 75,857; Qwen2.5 9,226 / 68,303 / 77,529. AIR stays 184,628 bytes / 47,445 cl100k tokens; library/std.md is unchanged. One rule follows an explicit ordinary-call signature so existing array-borrow parameters are callable; exact modes, lengths, lexical cleanup, named retained origins and task loans remain checked. No new syntax, diagnostic, feature or verifier/runtime state. Existing primitives suffice; no empirical MCC benefit is claimed.
+1
View File
@@ -102,6 +102,7 @@ ref q = p; // shared borrow of a struct; q.a reads a field
Rules (checked by the verifier):
- **A borrow lives until the end of the block where it was bound** (`ref r = …;` / `mut r = …;`). A borrow written as an argument (`f(mut buf)`) lives for that call. To end one early, put it in an inner `{ … }` block.
- A whole-array argument `f(ref a)` / `f(mut a)` preserves the array for a `ref<[T; N]>` / `mut<[T; N]>` parameter; otherwise it becomes a slice. Length and mode must match. Bound array borrows remain slices.
- **Exclusive XOR shared.** While a `mut` borrow of a place is live, no other borrow of the same place, and no direct use of it, is allowed (`E2101`). Disjoint fields and `split_at` halves are independent.
- A borrow cannot outlive what it borrows from (`E2102`). A function returns a borrow only with explicit `from param`. Bind returned views with `ref`/`mut`; the `from` argument must be a named borrow. Return the bound name without `move`; a local-frame view cannot escape (`E2108`).
- **Moves are explicit:** a named linear value is consumed only as `move x` (otherwise `E7003`). A fresh temporary needs no `move`: `consume(make())`. Copyable values are passed plainly; `move` on them is `E7006`.