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: 1 addition & 0 deletions quest/m3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ generic std gap is planned here even when moq never calls it.
- [Fresh writes through a zip, a copy, and a repeat](/quest/m3/ts-fresh-shapes.md) - zipping a `Vec<[T; N]>`, reading a `T` out of `Zip::next`, and `copied` or `vec![x; n]` over a `Copy` type translate
- [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
- [Python's call cost](/quest/m3/ffi-python-calls.md) - a call on an object costs what BoltFFI's does, or the gap is explained
- [A box's clone_from, and a vector's AsRef and AsMut](/quest/m3/ts-box-vec-conversions.md) - `clone_from` of a `Box<String>` and `AsRef<[T]>` of a `Vec` translate
16 changes: 16 additions & 0 deletions quest/m3/ts-box-vec-conversions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# [S] A box's clone_from, and a vector's AsRef and AsMut

## Goal

[rust2-ts](/ts/README.md) translates `Clone::clone_from` of a `Box<T>` whose `T` needs a
drop, such as `Box<String>`, dropping the old value where std's does, and `AsRef<[T]>` and
`AsMut<[T]>` of a `Vec<T>`, proven by differential tests against native Rust.

## Plan

Found by [#387](https://github.com/moq-dev/rust2/pull/387) after
[#386](https://github.com/moq-dev/rust2/pull/386) added a general `clone_from` rule, which
refuses a `Box<T>` whose `T` needs a drop, and `AsRef` and `AsMut` as a slice for arrays only.
No consumer calls them yet; they are planned here as part of std.

Public API: the translator's output.