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
@@ -185,6 +185,8 @@ Lowering: structured control flow becomes blocks and terminators. A variable ass
| `let (left, right) = s.split_at(k);` | `slice.split`: two disjoint borrows of `s`. Besides `atomic.compare_exchange` (§12), the only multi-result binding. There is no general tuple destructuring. |
| `slice.copy(mut dst, ref src)` | primitive `slice.copy`; insufficient capacity traps. Recoverable byte copy is `std.bytes.copy` (spec 16 §2.4). |
**Whole-array arguments.** In an ordinary function call, `ref place` / `mut place` MUST preserve a whole-array referent when the known parameter is `ref<[T; N]>` / `mut<[T; N]>`; otherwise the existing whole-array-to-slice rule applies. Element type, length and explicit borrow mode MUST match (`E7005`); a slice MUST NOT be converted back to an array borrow. This also applies after explicit generic/static-function specialization and to array fields, elements and dereferenced array borrows (`ref (*a)`). Shared reborrowing of an exclusive parent follows the existing AIR rule. All temporary ancestors end after the call, child first. Borrow bindings still produce slices; bare byte-string arguments still produce `slice<u8>`. The named-origin requirement of §19 and the named-loan requirement of `task.spawn` (§7) remain mandatory.
**Writes.**
- `*r = v;` for a scalar or struct referent;