Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions quest/m3/ts-unsafe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ none of its own `unsafe`. A union over a type parameter lays out each instance s
- Decided with the maintainer on 2026-11-01, typed allocation: memory from `alloc` for a
`Layout::array::<T>(n)`, or an equal layout of `T`'s size and alignment, cast to `*mut T`
is a fresh JS array of `T`s, which `realloc` copies and `dealloc` frees. Untyped and
byte allocation stay refused. smallvec spills to it, and
[`Vec::from_raw_parts` of it](/quest/m3/ts-unsafe/vec-from-raw-parts.md) is left.
byte allocation stay refused. smallvec spills to it, and `Vec::from_raw_parts` adopts
it, or a `Vec`'s own, as the `Vec`'s items.
- Decided with the maintainer on 2026-11-02: a raw slice pointer is `rs.RawSlice`, its
first element's pointer and its length, read through only where Rust reads, and an empty
slice from a pointer into no array keeps that pointer through every part of it.
Expand Down Expand Up @@ -73,7 +73,6 @@ Public API: the translator's output.
## Required

- [A raw pointer behind a reference](/quest/m3/ts-unsafe/raw-behind-ref.md) - `&raw const *r` of a value JS copies points where the reference came from
- [Vec::from_raw_parts of a typed allocation](/quest/m3/ts-unsafe/vec-from-raw-parts.md) - a `Vec` adopts an `alloc`ed array of `T`s, with its length, capacity, and drops
- [Vec::drain from std's MIR](/quest/m3/ts-unsafe/vec-drain-mir.md) - std's `Drain` translates, replacing the runtime's port
- [BinaryHeap from std's MIR](/quest/m3/ts-unsafe/binary-heap-mir.md) - std's `BinaryHeap` and `PeekMut` translate, replacing the runtime's port
- [Unchecked integer operations](/quest/m3/ts-unsafe/unchecked-ops.md) - `unchecked_*` and `NonZero::new_unchecked` translate, aborting on a violated precondition
Expand Down
18 changes: 0 additions & 18 deletions quest/m3/ts-unsafe/vec-from-raw-parts.md

This file was deleted.

11 changes: 9 additions & 2 deletions ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ crate translation reaches is refused, and so are two versions of one crate it re
| `Ordering`, `DefaultHasher`, `RandomState`, `BuildHasherDefault<H>` | `rs.Ordering`, which is `-1`, `0`, or `1`; `rs.Hasher`; `rs.RandomState`, the keys of the `DefaultHasher` it builds, never changed once made; `undefined`, as `PhantomData` is, whose `build_hasher` is `H::default()` |
| `Duration` | `rs.Duration`: `{ secs, nanos }`, std's whole seconds as an `rs.u64` and the nanoseconds past them, never changed once made |
| `TypeId` | `rs.TypeId`: rustc's 128-bit hash of the type, which std's holds at run time, as 32 hex digits, equal by `===`; ordered as std's derive orders the hash's pointer-sized words, lowest first, hashed as its high 64 bits, and written as `TypeId(0x…)`, as std's are |
| `Layout`, `alloc::alloc` | `rs.Layout`: `{ size, align }`, never changed once made, checked as std's constructors check it; `alloc` gives an `rs.Block` of its bytes, which a cast of its pointer to `*mut T` the body shows came from `alloc` or `realloc` makes a JS array of `T`s, values JS copies, as an `rs.AtIndex` of its first; a cast back to `*mut u8` only as what `dealloc` or `realloc` takes, which free the array or copy it into a new one; its bytes, read, written, or cast to any other type, are refused, and fail at run time through a pointer from elsewhere |
| `Layout`, `alloc::alloc` | `rs.Layout`: `{ size, align }`, never changed once made, checked as std's constructors check it; `alloc` gives an `rs.Block` of its bytes, which a cast of its pointer to `*mut T` the body shows came from `alloc` or `realloc` makes a JS array of `T`s, values JS copies, as an `rs.AtIndex` of its first; a cast back to `*mut u8` only as what `dealloc` or `realloc` take, an array `Vec::from_raw_parts` adopts as a `Vec`'s itemss, which free the array or copy it into a new one; its bytes, read, written, or cast to any other type, are refused, and fail at run time through a pointer from elsewhere |
| closure | an arrow function, with `[Symbol.dispose]` if it owns a value that drops, and what makes its clone if a clone can't be itself |
| `fn` pointer, function item as a value | the function, or std's an arrow that calls it as a written call does, as a closure is typed: a `()` result is `undefined`, where a declared function returns `void` |
| `&dyn Trait`, `&mut dyn Trait`, `Box<dyn Trait>`, `Arc<dyn Trait>`, `Rc<dyn Trait>`, `Weak<dyn Trait>`, `Pin<P>` of one | an object with the trait's methods, its supertraits' included: `shape.area$Shape()`; behind an `Arc` or an `Rc`, an `rs.ArcDyn` sharing the count of the `Arc` it was made from |
Expand Down Expand Up @@ -1060,7 +1060,14 @@ they need.
`truncate`, leaves the room as it was: std's `Vec` makes no promise to keep what it
removes, so the slot it gave up is uninitialized, and `set_len` requires every slot it
takes in to be initialized, which makes lengthening over that slot undefined in Rust
(decided with the maintainer on 2026-11-07). Their `try_reserve` and `try_reserve_exact`, and a
(decided with the maintainer on 2026-11-07). `Vec::from_raw_parts` of a pointer to the
start of memory from `alloc` or of a `Vec`'s, given up by `ManuallyDrop`, is the `Vec`
of that same storage, holding its first `length` items and, but for bytes, the rest in
its room, which `realloc` of the memory keeps, with the capacity it is given, so it drops
and reads back what std's does. One of a `Box`'s value holds it in the same place the pointer reads and writes, and one of
bytes from `alloc` new storage of the capacity; a
length past the capacity panics as std's check does, which can't unwind, and one of
values JS keeps as objects or of no bytes is refused. Their `try_reserve` and `try_reserve_exact`, and a
`String`'s, give `Ok` where `reserve` makes room and `TryReserveError`'s
`CapacityOverflow` where it panics, and `AllocError`, of the layout std's asks for, only
where JS fails to allocate a byte `Vec`'s or `VecDeque`'s `Uint8Array` (decided with the
Expand Down
Loading