From 703728e998e54578a5466bede62a6d7512c7759e Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Fri, 6 Nov 2026 18:51:16 -0800 Subject: [PATCH] quest(m5): key moq-net's model by explicit ids, with no cfg(rust2_ts) twins Co-Authored-By: Claude Opus 5.5 --- quest/m5/rs2ts-model-subset.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/quest/m5/rs2ts-model-subset.md b/quest/m5/rs2ts-model-subset.md index 91b56526523..bb21aa98834 100644 --- a/quest/m5/rs2ts-model-subset.md +++ b/quest/m5/rs2ts-model-subset.md @@ -15,16 +15,31 @@ rust2-ts stays general, translating safe dependencies from source and refusing ` and trait objects, so the moq-specific changes are made here. Waits until rust2's epic reaches the model; none of these changes behavior. -- Safe twins, under `cfg(rust2_ts)`, which rust2-ts's driver passes, for the internal - `unsafe`: - `model/group.rs`'s `MaybeUninit` frame ring, `NonNull` in `track.rs` and - `track/demand/ranges.rs`, `cache.rs`'s pointer identity, `frame.rs`'s `Segment`, and - kio's lock-free `log`. Differential tests cover the twins, and native builds keep the - `unsafe` versions. +- `Track` and `FrameContent` take a unique id at construction, a `u64` from a counter, and + key `cache.rs`'s deadlines and `frame.rs`'s per-group frames by it in place of their + addresses (`Arc::as_ptr(..) as usize`, and `ptr::from_ref(self) as usize` in `Drop`). + rust2-ts refuses every address read, while `ptr::eq` and `Arc::ptr_eq` translate. +- The internal `unsafe`: `model/group.rs`'s `MaybeUninit` frame ring, `NonNull` in + `track.rs` and `track/demand/ranges.rs`, `frame.rs`'s `Segment`, and kio's lock-free + `log`. Each is either rewritten in safe Rust for both builds, at measured native cost, or + left for rust2-ts's [unsafe epic](https://github.com/moq-dev/rust2/blob/main/quest/m3/ts-unsafe/README.md) + to translate as is. - `group.rs`'s `dyn Expiry` becomes an enum of its two implementations. - Drop `hashlink`, `slab`, and `smallvec` from the model's path where a std type does the job at measured cost, or bind them to hand-written TS through rust2-ts's config. +Decided with the rust2 maintainer on 2026-11-07, in +[rust2's model epic](https://github.com/moq-dev/rust2/blob/main/quest/m2/ts-model/README.md), +after rust2-ts's designs for addresses as identity +([moq-dev/rust2#596](https://github.com/moq-dev/rust2/pull/596)) kept leaking: + +- ✅ Explicit ids for the two address keys, the same in both builds (rejected: a + `cfg(rust2_ts)` twin; rust2-ts translating `Arc` addresses). +- ✅ No `cfg(rust2_ts)` twins anywhere: every change here is the same in native and + translated builds (rejected: twins until rust2-ts translates the `unsafe`). +- ✅ Whether each `unsafe` item is rewritten or waits on rust2-ts is decided per item when + this quest starts (rejected: deciding now). + Public API: none. ## Required