Skip to content
Merged
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
1 change: 0 additions & 1 deletion quest/m2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ The fork's feature quests folded into the [exporter](/quest/m1/ffi-export/README
- [Byte-slice locals that crash the translator](/quest/m2/ts-scalar-ice.md) - `take_apart` never reaches the arm `find_scalars` promised it wouldn't
- [Fixture cases by name](/quest/m2/ts-harness-names.md) - adding a harness case never renumbers another
- [Byte slices without objects](/quest/m2/ts-byte-views/README.md) - reading through a translated cursor allocates no object per read
- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - every value that drops in moq-net and kio drops where Rust drops it
- [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
- [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
Expand Down
4 changes: 0 additions & 4 deletions quest/m2/ts-async.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,3 @@ An async block that captures part of a variable, which THIR refused 47 times, is
capture like any other in MIR.

Public API: the translator's output for async code.

## Required

- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - async bodies hold the values that drop it still refuses
48 changes: 0 additions & 48 deletions quest/m2/ts-drop.md

This file was deleted.

1 change: 0 additions & 1 deletion quest/m2/ts-model/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Public API: the translator's output for moq-net's model.

## Required

- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - kio closes a channel when its last producer drops
- [Shared ownership](/quest/m2/ts-shared.md) - kio's waiters are `Arc`/`Weak` with observable counts, and its atomics and locks are plain values
- [Translate safe dependencies with the package](/quest/m2/ts-model/crates.md) - kio, moq-clock, moq-pattern, and rangemap translate as one program with moq-net
- [Std gaps the model reaches](/quest/m2/ts-model/std-more.md) - ranges, wrappers, and `Vec`'s editing methods
Expand Down
4 changes: 0 additions & 4 deletions quest/m2/ts-shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,3 @@ is its own guard. Left: `Rc`, `weak_count` (a dropped `Weak` counts nothing yet)
- Measure the counter overhead on the [TS benchmark](/ts/README.md#bench).

Public API: the translator's output for shared and interior-mutable types.

## Required

- [Drop in the TypeScript translator](/quest/m2/ts-drop.md) - the last strong drop runs `Drop`
1 change: 1 addition & 0 deletions quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ generic std gap is planned here even when moq never calls it.
- [An inclusive range drained by a fold](/quest/m3/ts-range-fold.md) - a folded `RangeInclusive` ends in core's state
- [bool's combinators from core's MIR](/quest/m3/ts-bool-core.md) - `bool::then` lowers from core, retiring `rt.boolThen`
- [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
42 changes: 42 additions & 0 deletions quest/m3/ts-drop-order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# [M] Drop order in std's folds and iterators

## Goal

[rust2-ts](/ts/README.md) translates the values that drop which it still refuses
inside std's iterators and formatting, each dropping where std's does, in std's order,
on a panic too, proven by the task fixture's differential and unwinding tests against
native Rust. None appears in moq's census at the pinned revision; rust2 aims to support
all of std.

## Plan

Moved from the m2 drop quest on 2026-10-27, once moq-net, its model, and kio had no
drop refusal left ([#139](https://github.com/kixelated/rust2/pull/139)). Each is refused
with a span where std's order is one JS's can't follow yet:

- A consumer that std folds (`count`, `fold`, `sum`, `collect`, ...) of an iterator
holding a closure that drops beside anything else that drops: std's `fold` drops an
adaptor's closure as its own ends, before the source, where dropping the adaptor
drops it after (`folds` and `held` in `iter.rs`).
- A closure that owns a value that drops given to a std function that takes another
value that drops by value, such as `for_each` of items that drop, that keeps it
other than in an adaptor, or that calls it through `FnOnce` other than where
`discards` in `library.rs` says, as `or_insert_with` does (`called_closures`).
- `into_keys` and `into_values` of a hash map whose other half drops: `fold` drops it
after the half it yields, `next` before.
- `zip` of two `TrustedRandomAccess` iterators of items that drop.
- A `flatten` whose inner iterator holds items once ended, or that a `fold` reads where
both its source and inner iterators drop.
- A B-tree's `collect` of entries that drop, sorted by the crate's own `Ord`.
- A `collect` in place of a `zip` whose second iterator drops.
- `DebugList::entries` of items that drop.

The fold refusals share one fix: give each `rt.Iter` a `fold` that drops what it holds
where std's `fold` for that adaptor does (`Map` and `Filter` delegate to their source's
with their closure wrapped, `TakeWhile`, `Chain`, and `Peekable` each fold their own
way), and have by-value consumers drop through it rather than `rt.drop`.

Watch the cost: measure any change to a hot path on the
[TS benchmark](/ts/README.md#bench).

Public API: the translator's output for values that drop in std's iterators.
5 changes: 3 additions & 2 deletions ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,9 @@ Until they translate, an item that needs one, such as a boxed future, binds to
hand-written TS ([bindings](#bindings)).

These fail translation: floats ([Floats](/quest/m2/ts-model/floats.md)), statics, async closures, a closure that owns a value
that drops given to std's iterators or collections, and values that drop in some
iterators ([Drop](/quest/m2/ts-drop.md)), a `Cow` of other than `str`,
that drops given to a std function that drops it beside another value that drops, as
`for_each` of items that drop does, or keeps it other than in an iterator adaptor, and
values that drop in some iterators ([drop order](/quest/m3/ts-drop-order.md)), a `Cow` of other than `str`,
a collection holding a type that can be `undefined`, as `()` and `Option` can, a std
function without a mapping of its own that makes or reads an `Option` whose `None` is
`rt.None`, as `find` over `Option`s does, an `Option` of an `Option` of `()` or another
Expand Down
Loading