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
2 changes: 1 addition & 1 deletion quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ generic std gap is planned here even when moq never calls it.
- [A slice of one byte behind any &mut](/quest/m3/ts-slice-of-one.md) - `slice::from_mut` and `array::from_mut` of a `&mut u8` translate
- [Waiting: a slice object for a mutable part of other values](/quest/m3/ts-slice-object.md) - waits on a moq profile showing the `Proxy` view's traps matter, then decides on an `rt.ByteSlice`-like form
- [Port the workflow guard to kixelated/quest](/quest/m3/quest-workflow-guard.md) - quest's environment guard parses YAML as this repository's does
- [An adaptor of the crate's own iterator held as a value](/quest/m3/ts-own-iter-value.md) - `map` and the other adaptors of a fieldless enum that implements `Iterator`, taken by value, translate
- [Debug of std's other iterators](/quest/m3/ts-iter-source-debug.md) - `Debug` of `Once`, `Repeat`, `FromFn`, an array's `IntoIter`, and std's other iterators writes what std's does
- [A vector keeps the capacity its pushes grew as it shrinks](/quest/m3/ts-vec-clear-capacity.md) - every step that drops a pushed `Vec`'s length keeps its capacity, as std guarantees
- [A vector's exact capacity as it shrinks](/quest/m3/ts-vec-exact-capacity.md) - a deque made from a `Vec` splits its slices where std's does
- [A B-tree's searches call Ord as std's do](/quest/m3/ts-btree-search-order.md) - a B-tree's lookups and inserts call a key's own `Ord` in std's order and number
- [A slice's chunks as mutable arrays](/quest/m3/ts-slice-conversions.md) - `as_chunks_mut` and `as_rchunks_mut` translate, writes landing in the slice
- [Comparing pointers to arrays of other values than bytes](/quest/m3/ts-array-ref-identity.md) - `ptr::eq` of pointers to a `[T; N]` of non-bytes translates, as a slice lends them too
- [Cow's clone_from, Reverse's clone, and Option::as_slice](/quest/m3/ts-std-stragglers.md) - three std methods still refused translate as std's behave
- [The rest of a vector's methods](/quest/m3/ts-vec-rest.md) - `try_reserve`, a deque's rotations and searches, and `Vec::splice` translate
- [Fresh writes beside a zipped iterator that points at a part](/quest/m3/ts-fresh-shapes.md) - zipping slots with a `Vec<[T; N]>`, `vec![row; n]`, or `copied` of what the slot holds translates
- [Python's wake on the loop's own thread](/quest/m3/ffi-python-wake.md) - a wake on the event loop's thread resumes the future with no socket pair
Expand Down
16 changes: 0 additions & 16 deletions quest/m3/ts-own-iter-value.md

This file was deleted.

23 changes: 23 additions & 0 deletions quest/m3/ts-std-stragglers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# [S] Cow's clone_from, Reverse's clone, and Option::as_slice

## Goal

[rust2-ts](/ts/README.md) translates `Cow<[T]>::clone_from`, `Clone` of `cmp::Reverse`,
and `Option::as_slice`, each as std's behaves, proven by differential tests against
native Rust.

## Plan

Found while keeping a `Vec`'s capacity through `clone_from`
([#533](https://github.com/moq-dev/rust2/pull/533)): each is refused with its span today.

- `Cow<[T]>::clone_from` of an owned `Cow` over an owned one keeps the target's buffer,
as `Vec::clone_from` does, so its capacity shows the difference from a fresh clone.
- `Reverse::clone` clones what it wraps, which may be a value that drops or one JS
shares, such as a `Vec`.
- `Option::as_slice` lends the payload as a slice of zero or one element; whether a
payload JS copies needs a place to lend it from, as `slice::from_ref` does, is open.

No consumer calls them yet; they are planned as part of std.

Public API: the translator's output.
4 changes: 3 additions & 1 deletion ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ and of one it owns, not borrows by `&mut` or boxes, its own `fold`, `rfold`, `co
`find`, `rfind`, `find_map`, `for_each`, `reduce`, `all`, and `is_sorted_by`, where std's
adaptors and consumers call them: a filter's `next` calls `find`, an `extend` into a hash or
B-tree collection, a `String`, or a tuple calls `for_each`, `max` calls `reduce`, and
`is_sorted` calls `is_sorted_by`, which calls `all`. Its
`is_sorted` calls `is_sorted_by`, which calls `all`. One whose JS value is copied, such as an
enum's, it holds as an `rt.Place` of its own, which its `next` and std's methods taking
`&mut self` write through, as they do the place a `&mut` to it is. Its
own `collect` into a `Vec` runs where std's `FromIterator` of a `Box<[T]>`, `Rc<[T]>`,
`Arc<[T]>`, `BTreeMap`, `BTreeSet`, or `BinaryHeap` calls it first, its own `eq` and
`partial_cmp` where `ne` and the tests on `partial_cmp` call them, and its own `by_ref`,
Expand Down
Loading