From a31da15d0d323ee38ca45c116fab3bc2bdcaac58 Mon Sep 17 00:00:00 2001 From: Luke Curley <432854+kixelated@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:59:27 -0800 Subject: [PATCH] chore(quest): plan a box's clone_from, and a vector's AsRef and AsMut Co-Authored-By: Claude Opus 5.5 --- quest/m3/README.md | 1 + quest/m3/ts-box-vec-conversions.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 quest/m3/ts-box-vec-conversions.md diff --git a/quest/m3/README.md b/quest/m3/README.md index f152025b4..c79b26afe 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -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` and `AsRef<[T]>` of a `Vec` translate diff --git a/quest/m3/ts-box-vec-conversions.md b/quest/m3/ts-box-vec-conversions.md new file mode 100644 index 000000000..af28709ca --- /dev/null +++ b/quest/m3/ts-box-vec-conversions.md @@ -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` whose `T` needs a +drop, such as `Box`, dropping the old value where std's does, and `AsRef<[T]>` and +`AsMut<[T]>` of a `Vec`, 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` 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.