cli: validate exclusive source places before AIR
This commit is contained in:
1 parent
dcd5f1f702
commit
41f3afbf05
54 files changed
+541
-2
No files matched your search
@@ -354,3 +354,9 @@ Audit non-value operands in ordinary calls, operators and aggregates against spe
|
||||
Q-047 review independently reproduced `fn update(p: ref<u64>) -> void effects [] { *p = 1u64; }`: it reaches AIR E1001 (`expected: mut<T>`, `found: ref<u64>`) instead of frontend E7xxx, although the mode is determined by source types (spec 15 §10). Review also observed accepted writes to fields of a `let` aggregate. An immutable binding does not necessarily imply immutable owned content; whether that behavior disagrees with the specification remains unverified and MUST NOT be guessed from the binding's `mutable` flag.
|
||||
|
||||
Audit existing place modes and referents against spec 15 §4/§5 and AIR borrow/store rules. Reject fully type-decided incompatibilities at the source, preserving ownership, aliasing/lifetime diagnostics, evaluation order and canonical AIR for valid source. Determine the binding/content distinction from governing text before proposing any semantic restriction.
|
||||
|
||||
**Resolved (spec 15 §10):** stores require `mut<T>`; explicit `mut` bindings and arguments require an exclusive place before array-to-slice conversion. Shared places reject E7005 with expected/found borrow types at the place or argument. This also prevents accepted `mut` bindings from silently retaining shared field/index/range modes, or requesting an exclusive slice from a shared array. Dereferenced slices are not scalar store places. Whole-array stores retain E7006; RHS evaluation, valid canonical AIR, ownership/projection/alias/lifetime rules and runtime semantics remain unchanged. Q-049 separates the unresolved Copy-let storage policy.
|
||||
|
||||
## Q-049 — Immutable Copy bindings and mutable frame content
|
||||
|
||||
Read-only Q-048 review reproduced accepted `let p = Pair { a: 0u64 }; p.a = 42u64; return p.a;`, and exclusive borrows of Copy-let frame storage. Spec 15 §4 calls `let` an immutable binding; assignment by name already rejects. Whether this should also prohibit content writes through fields/indices/borrows is unresolved. Owned content through `let` intentionally remains mutable and is used by public std examples. Do not infer a new restriction from `Binding.mutable`: distinguish Copy frame storage from owners, regions, resources and borrow bindings, and settle the normative policy before changing accepted source. This question is independent of Q-048's existing shared/exclusive borrow modes.
|
||||
Reference in new issue
Block a user