spec: spell the AIR array type array<T, N>
';' starts a comment in text AIR, so [T; N] cannot be parsed. Recorded as an erratum in RFC 0005; source syntax may keep [T; N].
This commit is contained in:
7 files changed
+20
-19
No files matched your search
@@ -193,10 +193,10 @@ Common contract unless stated: no effects, no capabilities, no synchronization.
|
||||
|
||||
| Instruction | Operands → result | Verifier | Runtime |
|
||||
|---|---|---|---|
|
||||
| `%a = array.splat [T; N] %v` | `T` → `[T; N]` | — | every element is `%v` |
|
||||
| `%e = borrow.index %b, %i` | `ref`/`mut` of `[T; N]`, or `slice`/`slice_mut` of `T`; `usize` → `ref<T>`/`mut<T>` | child of `%b` | traps `T0008` if `%i ≥ length` |
|
||||
| `%a = array.splat array<T, N> %v` | `T` → `array<T, N>` | — | every element is `%v` |
|
||||
| `%e = borrow.index %b, %i` | `ref`/`mut` of `array<T, N>`, or `slice`/`slice_mut` of `T`; `usize` → `ref<T>`/`mut<T>` | child of `%b` | traps `T0008` if `%i ≥ length` |
|
||||
| `%e = borrow.index.proven %b, %i` | as above | `%i < length` proven (spec 08 §12), otherwise `E2103` | no check |
|
||||
| `%s = slice.make %b` | `ref<[T; N]>`/`mut<[T; N]>` → `slice<T>`/`slice_mut<T>` | child of `%b` | whole array |
|
||||
| `%s = slice.make %b` | `ref<array<T, N>>`/`mut<array<T, N>>` → `slice<T>`/`slice_mut<T>` | child of `%b` | whole array |
|
||||
| `%n = slice.len %s` | `slice<T>`/`slice_mut<T>` → `usize` | — | length |
|
||||
| `%t = slice.sub %s, %start, %len` | slice, `usize`, `usize` → same slice type | child of `%s` | traps `T0008` unless `start ≤ slice.len(s)` and `len ≤ slice.len(s) − start` (evaluated without overflow); result covers `[start, start + len)` |
|
||||
| `%l, %r = slice.split %s, %at` | slice, `usize` → two slices of the same type | two children of `%s`, disjoint | traps `T0008` unless `at ≤ slice.len(s)`; `l` covers `[0, at)`, `r` covers `[at, len)` |
|
||||
|
||||
Reference in new issue
Block a user