From e3dc1cdcfc8313c2a576c6fcfb889cb4d95fd86d Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Wed, 28 Oct 2026 20:53:00 -0700 Subject: [PATCH] chore(quest): plan #204's and #205's follow-ups Co-Authored-By: Claude Opus 5.5 --- quest/m1/ffi-export/README.md | 1 + quest/m1/ffi-export/iterators.md | 21 +++++++++++++++++++++ quest/m3/README.md | 1 + quest/m3/ts-byte-edits.md | 21 +++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 quest/m1/ffi-export/iterators.md create mode 100644 quest/m3/ts-byte-edits.md diff --git a/quest/m1/ffi-export/README.md b/quest/m1/ffi-export/README.md index 03078d369..b847c5f5a 100644 --- a/quest/m1/ffi-export/README.md +++ b/quest/m1/ffi-export/README.md @@ -49,6 +49,7 @@ Every generator on the C ABI: - [Payloads cross as bytes](/quest/m1/ffi-export/payload-bytes.md) - a payload that is not UTF-8 crosses unchanged, where today it aborts from C, C++, and Kotlin - [Iterator and JSON arguments the exporter can't map yet](/quest/m1/ffi-export/instance-keys.md) - `IntoIterator` as a `Vec`, and `serde_json::Value` +- [Returned iterators cross as arrays](/quest/m1/ffi-export/iterators.md) - `Hops::iter`, `Versions::iter`, and `Patterns::iter` export, returning arrays as `&[T]` does - [moq-clock's C names once it moves into kio](/quest/m1/ffi-export/crates.md) - `moq_now` and `moq_origin` become the clock's, after moq moves it into `kio::clock` - [Sessions on moq-tokio](/quest/m1/ffi-export/session-tokio.md) - bindings connect and accept with one call, the library running moq-tokio inside - [Sessions on sans-IO QUIC](/quest/m1/ffi-export/session-quic.md) - bindings move UDP datagrams and drive the session's poll themselves diff --git a/quest/m1/ffi-export/iterators.md b/quest/m1/ffi-export/iterators.md new file mode 100644 index 000000000..b97b06bfd --- /dev/null +++ b/quest/m1/ffi-export/iterators.md @@ -0,0 +1,21 @@ +# [S] Returned iterators cross as arrays + +## Goal + +moq-net's `Hops::iter` and `Versions::iter` and moq-pattern's `Patterns::iter` export +without being excluded in `ffi/moq/ffi.toml`, each returning what it iterates as an array, +as a `&[T]` return crosses. This comes from a fixed rule, with no config. + +## Plan + +Found by [#205](https://github.com/kixelated/rust2/pull/205) on 2026-10-28, which exports +`&[T]` of any type. + +- `std::slice::Iter<'_, T>` is a borrowed slice, so it crosses exactly as `&[T]` does. +- `Versions::iter` returns `impl Iterator`. Collecting it at the return is + exact only for an iterator that reads borrowed data, with no side effect and an end; + decide which `impl Iterator` returns the rule takes when the quest starts, and refuse the + rest with a span. +- Report moq-ffi's coverage and the census before and after. + +Public API: the C names and types these methods export with. diff --git a/quest/m3/README.md b/quest/m3/README.md index c101b1d6f..206557ec4 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -23,6 +23,7 @@ generic std gap is planned here even when moq never calls it. - [Binding gaps](/quest/m3/ts-bind-gaps.md) - bound types as keys, unit returns checked, renamed dependencies - [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's folds, zips, flattens, and collects drop as std's do - [Checks on the differential harnesses](/quest/m3/ts-harness.md) - step lists that drift, literal op bytes, and `refs`'s coverage fail a test or get cases +- [Edits of byte vectors and slices](/quest/m3/ts-byte-edits.md) - `retain`, `dedup`, `insert`, `remove`, and the rest translate on `Vec` and `[u8]` as on other elements - [Ordering in std](/quest/m3/ts-ordering.md) - `cmp::max`/`min`, `is_sorted`, and `BinaryHeap`, and #173's cost on integers measured - [Debug and Display of Arc and ranges](/quest/m3/ts-fmt-wrappers.md) - `Arc` formats as `T`, and ranges as std's `Debug` - [Fold a match a bool decided](/quest/m3/ts-fold-bool.md) - `if matches!` and derived `==` drop a later match's dead arms diff --git a/quest/m3/ts-byte-edits.md b/quest/m3/ts-byte-edits.md new file mode 100644 index 000000000..313532472 --- /dev/null +++ b/quest/m3/ts-byte-edits.md @@ -0,0 +1,21 @@ +# [S] Edits of byte vectors and slices + +## Goal + +rust2-ts translates every `Vec` and slice method on `Vec` and `[u8]` that it translates +for other element types, such as `retain`, `retain_mut`, `dedup`, `insert`, `remove`, +`swap_remove`, and the slice's `last`, `reverse`, `swap`, and sorts, proven by differential +tests against native Rust. + +## Plan + +Found by [#204](https://github.com/kixelated/rust2/pull/204) on 2026-10-28, whose fixture +hit `retain` on a `Vec`: the mappings in `library.rs` skip `u8` elements, which are an +`rt.ByteVec` or `rt.ByteSlice` rather than an array, and nothing maps them instead. rust2 +aims to support all of std, so this has no moq consumer. + +- Find every such skip rather than only the methods named here, and give each the + `rt.ByteVec` or `rt.ByteSlice` counterpart, with the closure's drop and the element's + equality as the generic path has them. + +Public API: the translator's output.