From aa9a460ab9266635d9919eb2e22ca1eeeac84f17 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Wed, 28 Oct 2026 15:40:05 -0700 Subject: [PATCH] chore(quest): plan the 2026-10-28 follow-ups Co-Authored-By: Claude Opus 5.5 --- quest/m1/ffi-export/README.md | 4 ++++ quest/m1/ffi-export/inference-gate.md | 20 +++++++++++++++++++ quest/m1/ffi-export/kotlin-android.md | 21 ++++++++++++++++++++ quest/m1/ffi-export/payload-bytes.md | 24 +++++++++++++++++++++++ quest/m1/ffi-export/recursion-lint.md | 19 ++++++++++++++++++ quest/m2/README.md | 2 ++ quest/m2/ts-aliases.md | 28 +++++++++++++++++++++++++++ quest/m2/ts-async.md | 6 ++++++ quest/m2/ts-model/README.md | 3 +++ quest/m2/ts-model/bytes.md | 22 +++++++++++++++++++++ quest/m2/ts-model/kio-std.md | 24 +++++++++++++++++++++++ quest/m2/ts-model/places.md | 26 +++++++++++++++++++++++++ quest/m2/ts-std-build.md | 21 ++++++++++++++++++++ quest/m3/README.md | 8 +++++++- quest/m3/ffi-instance-rename.md | 20 +++++++++++++++++++ quest/m3/quest-workflow-guard.md | 16 +++++++++++++++ quest/m3/ts-fmt-wrappers.md | 16 +++++++++++++++ quest/m3/ts-fold-bool.md | 16 +++++++++++++++ quest/m3/ts-harness.md | 20 +++++++++++++++++++ quest/m3/ts-ordering.md | 22 +++++++++++++++++++++ quest/m3/ts-range-fold.md | 9 +++++++-- 21 files changed, 344 insertions(+), 3 deletions(-) create mode 100644 quest/m1/ffi-export/inference-gate.md create mode 100644 quest/m1/ffi-export/kotlin-android.md create mode 100644 quest/m1/ffi-export/payload-bytes.md create mode 100644 quest/m1/ffi-export/recursion-lint.md create mode 100644 quest/m2/ts-aliases.md create mode 100644 quest/m2/ts-model/bytes.md create mode 100644 quest/m2/ts-model/kio-std.md create mode 100644 quest/m2/ts-model/places.md create mode 100644 quest/m2/ts-std-build.md create mode 100644 quest/m3/ffi-instance-rename.md create mode 100644 quest/m3/quest-workflow-guard.md create mode 100644 quest/m3/ts-fmt-wrappers.md create mode 100644 quest/m3/ts-fold-bool.md create mode 100644 quest/m3/ts-harness.md create mode 100644 quest/m3/ts-ordering.md diff --git a/quest/m1/ffi-export/README.md b/quest/m1/ffi-export/README.md index d7903b789..2b5000354 100644 --- a/quest/m1/ffi-export/README.md +++ b/quest/m1/ffi-export/README.md @@ -47,11 +47,15 @@ Every generator on the C ABI: ## Required +- [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` +- [Fail CI on an instance not inferred](/quest/m1/ffi-export/inference-gate.md) - a gap in instance inference fails CI instead of sitting in the census - [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` - [Setters for an object's pub fields](/quest/m1/ffi-export/field-setters.md) - C fills in a session's config, as Rust assigns it - [Session config's foreign types](/quest/m1/ffi-export/foreign-types.md) - `Url`, `SocketAddr`, `PathBuf`, and `Vec` cross the C ABI - [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 +- [The recursion depth lint on moq's export](/quest/m1/ffi-export/recursion-lint.md) - `just ffi moq` builds clean before the lint becomes an error - [C++ bindings on MSVC and Clang](/quest/m1/ffi-export/cpp.md) - the C++ header built and tested beyond GCC on Linux - [Kotlin bindings: zero-copy payloads and the read path](/quest/m1/ffi-export/kotlin.md) - the Kotlin lends bytes without a copy, and reads at JNI's cost +- [Kotlin bindings on Android](/quest/m1/ffi-export/kotlin-android.md) - an R8 keep rule for JNI's lookups, and an emulator run in CI diff --git a/quest/m1/ffi-export/inference-gate.md b/quest/m1/ffi-export/inference-gate.md new file mode 100644 index 000000000..47e659c4b --- /dev/null +++ b/quest/m1/ffi-export/inference-gate.md @@ -0,0 +1,20 @@ +# [XS] Fail CI on an instance not inferred + +## Goal + +CI fails when any crate's census reports `instance not inferred`, so a gap in the +exporter's instance inference is caught when it appears instead of sitting in a census no +one reads. + +## Plan + +[#188](https://github.com/kixelated/rust2/pull/188) made inference one pass before typing. +Where inference misses an instance typing reaches, typing refuses the item as +`instance not inferred`. That refusal means the exporter has a bug, not that the crate uses +something unsupported. No crate reports it today, so the check passes from the start. + +- Check every census the exporter runs: the fixtures' in the merge gate, and moq's in the + job that already runs it. +- Fail with the item and its span, so the report says what to fix. + +Public API: none. diff --git a/quest/m1/ffi-export/kotlin-android.md b/quest/m1/ffi-export/kotlin-android.md new file mode 100644 index 000000000..f734e8eaa --- /dev/null +++ b/quest/m1/ffi-export/kotlin-android.md @@ -0,0 +1,21 @@ +# [M] Kotlin bindings on Android + +## Goal + +The generated Kotlin runs on Android, not only the JVM: an app shrunk by R8 keeps the +methods JNI looks up by name, and an Android emulator run of the Kotlin tests proves it in +CI. + +## Plan + +Found by [#184](https://github.com/kixelated/rust2/pull/184) on 2026-10-28, which builds and +tests the Kotlin on the JVM only. + +- R8 and ProGuard rename or strip `Native`'s dispatchers, which the JNI glue finds by name. + Ship a keep rule with the generated Kotlin, in the form an Android library consumes + (`consumer-rules.pro` or the AAR's `proguard.txt`), and test a minified build with it. +- The emulator run is slow: put it in the nightly workflow, not the merge gate. +- Check what the Android API levels moq targets give the Kotlin, such as the + `java.lang.ref.Cleaner` question in [the Kotlin quest](/quest/m1/ffi-export/kotlin.md). + +Public API: the keep rule shipped beside the generated Kotlin. diff --git a/quest/m1/ffi-export/payload-bytes.md b/quest/m1/ffi-export/payload-bytes.md new file mode 100644 index 000000000..110a522cb --- /dev/null +++ b/quest/m1/ffi-export/payload-bytes.md @@ -0,0 +1,24 @@ +# [S] Payloads cross as bytes + +## Goal + +A parameter that takes bytes, such as moq's `impl Into` frame payloads +(`group::Producer::write_frame`), exports as bytes in the C ABI and every generator, so a +payload that is not valid UTF-8 crosses unchanged. Today it resolves to `String`: C and C++ +abort on such a payload, and Kotlin's `writeFrame` takes a `String`. + +## Plan + +Found by [#184](https://github.com/kixelated/rust2/pull/184) on 2026-10-28. This is a +correctness bug: moq's media payloads are binary. + +- Find why first. [`choose`](/ffi/src/collect.rs) puts `X` of `impl Into` ahead of + `String`, so the signature moq writes, or the bound typing reads, differs from what the + rule expects. +- Fix the rule, not moq's case: any parameter whose bounds `Bytes` or `Vec` meets but + whose meaning is bytes must not narrow to `String`. A `String` choice stays only where + the bound itself is about text. +- Prove it from C, C++, and Kotlin with a payload that is not UTF-8, and report the census + before and after. + +Public API: the C, C++, and Kotlin types of the affected parameters. diff --git a/quest/m1/ffi-export/recursion-lint.md b/quest/m1/ffi-export/recursion-lint.md new file mode 100644 index 000000000..c0d40731e --- /dev/null +++ b/quest/m1/ffi-export/recursion-lint.md @@ -0,0 +1,19 @@ +# [S] The recursion depth lint on moq's export + +## Goal + +`just ffi moq` builds with no `recursion_depth_exceeding_limit` warning, before the pinned +nightly turns that future-compat lint into a hard error and the export stops building. + +## Plan + +Found by [#144](https://github.com/kixelated/rust2/pull/144) on 2026-10-27: the lint fires on +`Send` checks in moq-net, moq-tokio, and the generated `moq_ffi`. + +- Find which types' `Send` checks recurse that deep, and whether the generated glue makes + them deeper than moq's own code does. +- Fix the generated part here. A part in moq's own crates is moq's change, recorded in + moq's tree; a `recursion_limit` raise is a stopgap only if neither can avoid the depth. +- Fail the build on the lint once it is gone, so it does not come back. + +Public API: none. diff --git a/quest/m2/README.md b/quest/m2/README.md index 372185fcc..c32ab1dd8 100644 --- a/quest/m2/README.md +++ b/quest/m2/README.md @@ -29,6 +29,8 @@ The fork's feature quests folded into the [exporter](/quest/m1/ffi-export/README - [Byte slices without objects](/quest/m2/ts-byte-views/README.md) - reading through a translated cursor allocates no object per read - [Async in the TypeScript translator](/quest/m2/ts-async.md) - moq-net's and kio's async code translates with Rust's lazy futures - [Shared ownership](/quest/m2/ts-shared.md) - `Arc`/`Rc`/`Weak` keep exact counts, and locks and atomics become plain values +- [Held values that name a reassigned variable](/quest/m2/ts-aliases.md) - a held place or folded value reads what Rust read, in and across loop iterations - [Translate moq-net's model to TypeScript](/quest/m2/ts-model/README.md) - the model translates with kio, moq-clock, and moq-pattern, for moq to compare against WASM +- [Translate against the prebuilt std](/quest/m2/ts-std-build.md) - measure whether `-Zbuild-std` is still needed now that panics abort, and drop it if not - [Waiting: Swift 6.4 in nixpkgs-unstable](/quest/m2/uniffi-swift-arm.md) - the nightly UniFFI fixtures move back to arm - [Waiting: ubrn reads UniFFI 0.32](/quest/m2/ubrn-release.md) - the binding benchmark's browser runner pins a ubrn release, not an open PR diff --git a/quest/m2/ts-aliases.md b/quest/m2/ts-aliases.md new file mode 100644 index 000000000..3255d4243 --- /dev/null +++ b/quest/m2/ts-aliases.md @@ -0,0 +1,28 @@ +# [M] Held values that name a reassigned variable + +## Goal + +Wherever rust2-ts holds an expression back instead of reading it once, the held value +reads what Rust read when it was made, even after a variable it names is assigned again, +including on a later iteration of a loop. Proven by differential tests against native Rust +that reassign each name between the hold and the read, in and across loop iterations. + +## Plan + +Collected on 2026-10-28 from three reports of one shape: + +- `stable_path` holds only the outermost object of a place, so an index inside it + (`a[i].b[j]` with `i` reassigned while the borrow lives) is read live + ([#176](https://github.com/kixelated/rust2/pull/176)). +- `alias()`'s copy arm treats a held-back source local as stable, though its folded value + may name a variable assigned again ([#148](https://github.com/kixelated/rust2/pull/148)). + No miscompile was found through it, but it is #148's bug in another place. +- Values made in a loop that share one JS binding across iterations where each Rust + iteration has its own value. + +Audit every place the lowering folds or holds an expression rather than fixing these one +by one: the rule is one check of which names a held value reads and whether any can be +written before the read. #148's review also asked for differential coverage of reborrows +through a reassigned reference and of indexed borrows. + +Public API: the translator's output. diff --git a/quest/m2/ts-async.md b/quest/m2/ts-async.md index d6e871201..ae3088d1b 100644 --- a/quest/m2/ts-async.md +++ b/quest/m2/ts-async.md @@ -27,6 +27,12 @@ moq-net still needs, by its census from MIR at the pinned revision: [bindings](/ts/README.md#bindings). The rest of kio's API translates from source across crates; what it still refuses is std's. - The edge: `rt.spawn`'s shape for callers, and cancelling a spawned task. +- `kio::Waiter::poll_future::<()>` does not normalize in moq-net's census, since `()` is + no `Future`. It is reached from `util.rs`'s `future_task` closure, itself refused as a + `Box`, and the same call translates in the fixture + ([#141](https://github.com/kixelated/rust2/pull/141), + [#183](https://github.com/kixelated/rust2/pull/183)). Find where polymorphic lowering + makes the `()`. An async block that captures part of a variable, which THIR refused 47 times, is a capture like any other in MIR. diff --git a/quest/m2/ts-model/README.md b/quest/m2/ts-model/README.md index 39d60b11f..5aab22361 100644 --- a/quest/m2/ts-model/README.md +++ b/quest/m2/ts-model/README.md @@ -49,4 +49,7 @@ Public API: the translator's output for moq-net's model. - [Shared ownership](/quest/m2/ts-shared.md) - kio's waiters are `Arc`/`Weak` with observable counts, and its atomics and locks are plain values - [Float formatting](/quest/m2/ts-model/floats.md) - `f64` formats and parses as std does - [The rest of std the model reaches](/quest/m2/ts-model/std-rest.md) - `Vec` and `VecDeque` capacity, and `RandomState` +- [Writes through places the model still refuses](/quest/m2/ts-model/places.md) - `get_or_insert_default` through a `&mut`, and `mem::take` of a captured `&mut Vec` +- [std gaps kio reaches](/quest/m2/ts-model/kio-std.md) - `array::from_fn`, `Default` of arrays and `()`, and maps of `Option`s +- [bytes' BytesMut, Buf, and BufMut](/quest/m2/ts-model/bytes.md) - map without config, so the model's `BytesMut` binding goes - [Async in the TypeScript translator](/quest/m2/ts-async.md) - kio's producers and consumers are futures diff --git a/quest/m2/ts-model/bytes.md b/quest/m2/ts-model/bytes.md new file mode 100644 index 000000000..76b070797 --- /dev/null +++ b/quest/m2/ts-model/bytes.md @@ -0,0 +1,22 @@ +# [M] bytes' BytesMut, Buf, and BufMut + +## Goal + +rust2-ts maps `bytes::BytesMut` and the `Buf` and `BufMut` traits with no config, as +[#147](https://github.com/kixelated/rust2/pull/147) maps `Bytes`, so `ts/moq/model.toml` +drops its `BytesMut` binding and moq-net's code generic over `Buf` and `BufMut` translates. +Proven by differential tests against native Rust. + +## Plan + +Found by #147 on 2026-10-27: the model reaches `BytesMut`, which is bound because its +`unsafe` doesn't translate, and moq-net's codec is generic over `Buf` and `BufMut`. + +- Share `Bytes`'s representation where `BytesMut` freezes into one or splits off, and match + `bytes`' observable behavior: `capacity`, `reserve`'s growth, and what `split_to` and + `freeze` share. +- `Buf` and `BufMut` as generic bounds belong here; `dyn Buf` belongs to + [trait objects](/quest/m3/ts-dyn.md). +- Measure the codec on the [TS benchmark](/ts/README.md#bench) before and after. + +Public API: the translator's output. diff --git a/quest/m2/ts-model/kio-std.md b/quest/m2/ts-model/kio-std.md new file mode 100644 index 000000000..6bc7b0240 --- /dev/null +++ b/quest/m2/ts-model/kio-std.md @@ -0,0 +1,24 @@ +# [S] std gaps kio reaches + +## Goal + +rust2-ts translates the std that kio reaches and no other quest owns, proven by +differential tests against native Rust: `array::from_fn`, `Default` of arrays (kio's +`[Atomic; 8]::default()`) and of `()`, and a `HashMap` whose values are `Option`s +(`shared.rs`). + +## Plan + +Found by [#167](https://github.com/kixelated/rust2/pull/167) and +[#183](https://github.com/kixelated/rust2/pull/183). kio's `static` atomics belong to +[shared ownership](/quest/m2/ts-shared.md). Kept apart from +[the rest of std](/quest/m2/ts-model/std-rest.md), whose capacity work is a hot-path change +of its own. + +- `Default` and `from_fn` of an array run element by element in index order, which an + element whose constructor has effects or panics observes. +- A map of `Option`s needs its `Option`-returning methods (`get`, `insert`, `remove`) to + tell `None` from `Some(None)`; [#134](https://github.com/kixelated/rust2/pull/134) gave + `rt.None` for that. + +Public API: the translator's output. diff --git a/quest/m2/ts-model/places.md b/quest/m2/ts-model/places.md new file mode 100644 index 000000000..aa93ae935 --- /dev/null +++ b/quest/m2/ts-model/places.md @@ -0,0 +1,26 @@ +# [M] Writes through places the model still refuses + +## Goal + +rust2-ts translates the writes through a place that the model's census still refuses, +proven by differential tests against native Rust: + +- `Option::get_or_insert_default` on an `Option` reached through a `&mut`, such as a + `&mut Option>` from a match on `&mut self.fields` (moq-net's `group.rs`), and the + call it is still refused as outright (`origin.rs`). +- `mem::take` of a `&mut Vec` a closure captured (`origin.rs`), refused as "replacing the + value behind a reference". + +## Plan + +Found by [#168](https://github.com/kixelated/rust2/pull/168) on 2026-10-28: four +`get_or_insert_default` refusals stayed with [#149](https://github.com/kixelated/rust2/pull/149)'s +`rt.Place`s landed, and no quest owns them since #149 deleted its own. + +- Both are a place the lowering can't name: a captured `&mut` is a capture of a place, not a + std gap, and `get_or_insert_default` already lowers in `call.rs` where its place guard + allows. Find what each guard refuses, and widen it only as far as the semantics stay + exact. +- Report the model's census before and after. + +Public API: the translator's output. diff --git a/quest/m2/ts-std-build.md b/quest/m2/ts-std-build.md new file mode 100644 index 000000000..c3ee432ef --- /dev/null +++ b/quest/m2/ts-std-build.md @@ -0,0 +1,21 @@ +# [S] Translate against the prebuilt std + +## Goal + +Decide, by measurement, whether rust2-ts still needs `-Zbuild-std` now that it aborts on +panic ([#187](https://github.com/kixelated/rust2/pull/187)), and drop it if not, making the +translator's builds faster and simpler. + +## Plan + +Suggested by #187 on 2026-10-28. + +- Translate the fixtures and moq's census against the prebuilt std and diff the census and + every snapshot against today's. Equal output, with the differential tests passing, is + the bar. +- The risk: the prebuilt std is built with optimizations that may inline or rewrite calls + the translator expects to see by path (std's iterators, formatting, and the calls in + `library.rs`), so its MIR may differ from what `-Zbuild-std` gives. +- Measure the build time saved. + +Public API: none, unless the toolchain the driver needs changes. diff --git a/quest/m3/README.md b/quest/m3/README.md index 64af53a64..644b41b87 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -19,6 +19,12 @@ generic std gap is planned here even when moq never calls it. - [f32](/quest/m3/ts-f32.md) - `f32` and `Duration`'s `f32` methods translate as `f64` does - [Trait objects](/quest/m3/ts-dyn.md) - `dyn Trait` and `Box` translate, so a consumer neither rewrites nor binds them - [Waiting: type-check in process with tsrs](/quest/m3/ts-tsrs.md) - rust2-ts checks bindings through tsrs instead of `tsc` once it is a stable library -- [An inclusive range folded through an adaptor](/quest/m3/ts-range-fold.md) - a `RangeInclusive` folded through `map`, `filter`, or `rev` ends in core's state +- [An inclusive range folded through an adaptor](/quest/m3/ts-range-fold.md) - a `RangeInclusive` folded through `map`, `filter`, or `rev` ends in core's state, and `by_ref` of one type-checks - [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 +- [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 +- [Rename one instance](/quest/m3/ffi-instance-rename.md) - `rename` by an instance's path, once a consumer's clash needs it +- [Port the workflow guard to kixelated/quest](/quest/m3/quest-workflow-guard.md) - quest's environment guard parses YAML as this repository's does diff --git a/quest/m3/ffi-instance-rename.md b/quest/m3/ffi-instance-rename.md new file mode 100644 index 000000000..e4b1231b8 --- /dev/null +++ b/quest/m3/ffi-instance-rename.md @@ -0,0 +1,20 @@ +# [XS] Rename one instance + +## Goal + +A `rename` keyed by an instance's path, such as +`"catalog::Producer"`, renames that instance alone, as +`exclude` already takes an instance's path. Today `rename` takes only the generic item's +path, which renames every instance. + +## Plan + +Suggested by [#152](https://github.com/kixelated/rust2/pull/152) on 2026-10-27. No consumer +needs it yet: a clash between an instance and an unrelated item is fixed today by renaming +the unrelated item or the generic one. Start once a consumer's clash can't be fixed that +way. + +- Prefer a naming rule that avoids the clash over a new config key, since every config key + a consumer needs is a gap; take this only if no rule does. + +Public API: `ffi.toml`'s `rename` keys. diff --git a/quest/m3/quest-workflow-guard.md b/quest/m3/quest-workflow-guard.md new file mode 100644 index 000000000..b66b6ba1a --- /dev/null +++ b/quest/m3/quest-workflow-guard.md @@ -0,0 +1,16 @@ +# [S] Port the workflow guard to kixelated/quest + +## Goal + +kixelated/quest's `test/workflows.test.ts` parses workflows as YAML, as +[`.github/land.test.ts`](/.github/land.test.ts) does here, so an environment named through +an expression, a flow mapping, or another repository's reusable workflow can't slip past +its guard on the `land` environment. + +## Plan + +Found by [#137](https://github.com/kixelated/rust2/pull/137) on 2026-10-26: quest's guard +has the gaps this repository's closed. The work lands in kixelated/quest, through its own +review; this quest tracks it here and is deleted once it merges there. + +Public API: none. diff --git a/quest/m3/ts-fmt-wrappers.md b/quest/m3/ts-fmt-wrappers.md new file mode 100644 index 000000000..8fdc5a61f --- /dev/null +++ b/quest/m3/ts-fmt-wrappers.md @@ -0,0 +1,16 @@ +# [S] Debug and Display of Arc and ranges + +## Goal + +rust2-ts formats `Arc` as `T` formats with `Debug` and `Display`, and std's ranges with +`Debug`, byte for byte as std does, including format specs a range passes to its bounds. +Proven by differential tests against native Rust. + +## Plan + +Suggested by [#177](https://github.com/kixelated/rust2/pull/177) (`Arc`, refused for every +`T`) and [#179](https://github.com/kixelated/rust2/pull/179) (ranges) on 2026-10-27. rust2 +aims to support all of std. A drained `RangeInclusive` prints `exhausted` in its `Debug`, +which [the range fold](/quest/m3/ts-range-fold.md) makes observable. + +Public API: the translator's output. diff --git a/quest/m3/ts-fold-bool.md b/quest/m3/ts-fold-bool.md new file mode 100644 index 000000000..e56184743 --- /dev/null +++ b/quest/m3/ts-fold-bool.md @@ -0,0 +1,16 @@ +# [S] Fold a match a bool decided + +## Goal + +rust2-ts drops the dead arms of a match that a `bool` already decided, as +[#175](https://github.com/kixelated/rust2/pull/175) does for a match an `if` or guard sits +in front of: `if matches!(s, Shape::Dot) { match s { .. } }`, and `==` of a crate enum's +derived `PartialEq`. Output only shrinks; the differential tests stay equal. + +## Plan + +Suggested by #175 on 2026-10-27: the `bool` joins two edges before the `if`, so folding it +means recording, in `decided.rs`'s dataflow, which variants a `bool` local holds `true` +for. Measure the size change on moq-net and the TS benchmark's bundles. + +Public API: the translator's output. diff --git a/quest/m3/ts-harness.md b/quest/m3/ts-harness.md new file mode 100644 index 000000000..e4957132d --- /dev/null +++ b/quest/m3/ts-harness.md @@ -0,0 +1,20 @@ +# [S] Checks on the differential harnesses + +## Goal + +The differential harnesses can't silently test less than they claim: a test fails when the +task fixture's step list in Rust (`harness.rs`) and TypeScript (`tests/task.ts`) drift +apart, when a scripted case's literal op bytes stop picking the step or case it names, and +an audit of `lang`'s `refs` case shows which of the place lowering's branches it reaches. + +## Plan + +Planned on 2026-10-28. Both lists are matched by order today, so a step added to one side +only shifts every op after it, and a script written as bytes rather than by name keeps +running whatever its bytes now pick. + +- Compare the lists by name in a test, rather than generating one from the other. +- The `refs` audit adds cases for the branches it misses, such as #148's review asked: + reborrows through a reassigned reference, and indexed borrows. + +Public API: none. diff --git a/quest/m3/ts-ordering.md b/quest/m3/ts-ordering.md new file mode 100644 index 000000000..a3e5c7901 --- /dev/null +++ b/quest/m3/ts-ordering.md @@ -0,0 +1,22 @@ +# [M] Ordering in std + +## Goal + +rust2-ts translates `cmp::max` and `cmp::min` (the free functions), the `is_sorted` +family, and `BinaryHeap`, proven by differential tests against native Rust, and the cost +of [#173](https://github.com/kixelated/rust2/pull/173)'s comparison tests on integers is +measured and, if it shows, removed. + +## Plan + +Planned on 2026-10-28; rust2 aims to support all of std, so this has no moq consumer. +#173 found `cmp::max` and `cmp::min` refused. + +- These compare through `PartialOrd::lt` and the rest as #173 builds them, so a crate's own + `lt` is called where std calls it. `BinaryHeap`'s sift order decides which of equal + elements comes out first and which comparisons run, so port std's. +- #173 passes `rt.cmpLt(cmp)` where sorts and `max`/`min` took `cmp`. Measure sorts and + `max`/`min` of integers on the [TS benchmark](/ts/README.md#bench) against the + commit before #173. + +Public API: the translator's output. diff --git a/quest/m3/ts-range-fold.md b/quest/m3/ts-range-fold.md index adfe3de8a..1d552dd70 100644 --- a/quest/m3/ts-range-fold.md +++ b/quest/m3/ts-range-fold.md @@ -1,11 +1,11 @@ -# [S] An inclusive range folded through an adaptor +# [M] An inclusive range folded through an adaptor ## Goal A `RangeInclusive` borrowed by `by_ref` and drained by a fold through an adaptor (`map`, `filter`, `rev`, `chain`, `peekable`, `take`, `skip`, ...) ends in core's state, `exhausted` with `start == end`, where std's adaptor folds the range, proven by a differential test -against native Rust. +against native Rust. `for _ in r.by_ref()` over a `RangeInclusive`, then using `r`, type-checks. ## Plan @@ -26,4 +26,9 @@ adaptor where a consumer reads it by `next`: - `zip` and `step_by` read by `next`, as std's do. - `collect` and `extend` fold only a `TrustedLen` iterator and read others by `next`. +`for _ in r.by_ref()` fails `tsc` today (`rt.iterBorrow(r)` is an `Iter`, not the +`rt.RangeInclusive` it is assigned to), found by +[#147](https://github.com/kixelated/rust2/pull/147): `IntoIterator` for `&mut I` is typed as +a plain iterator. The fixtures drain with `while r.next().is_some()` around it. + Public API: the translator's output.