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 @@ -51,3 +51,4 @@ memory model for values whose address is reinterpreted, without a consumer.
- [Browser APIs through wasm-bindgen](/quest/m3/ts-wasm-bindgen/README.md) - web-sys and js-sys imports become direct JS calls, so idiomatic crates such as web-rs's web-codecs translate as stock crates
- [`if let` of a temporary whose rest drops](/quest/m3/ts-if-let-drop.md) - `if let Some(E::A(x)) = temp()` with a destructor in the rest of `temp` emits TypeScript that type-checks
- [`u64` wrapping arithmetic in V8](/quest/m3/ts-u64-wrapping.md) - `rs.u64WrappingAdd` and its kin cost near a plain `+` while the value is a safe integer
- [Array references from slices and cells](/quest/m3/ts-array-ref-conversions.md) - `try_into` of a slice into an array reference, `Cell::as_array_of_cells`, and `identity` of a `&mut [T; N]` lend the array where it is
20 changes: 20 additions & 0 deletions quest/m3/ts-array-ref-conversions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# [S] Array references from slices and cells

## Goal

[rust2-ts](/ts/README.md) translates `TryFrom<&mut [T]> for &mut [T; N]` (and its `&[T]`
twin, as `slice.try_into()` reaches them), `Cell::as_array_of_cells`, and
`convert::identity` of a `&mut [T; N]`, each lending the array where it is, proven by
differential tests against native Rust. Today each is an unsupported call.

## Plan

Suggested on [#662](https://github.com/moq-dev/rust2/pull/662), which removed `arrayView`
and lends parts of arrays where they are: its tests use `first_chunk_mut` in place of these.
`try_into` of a slice into an array reference is common in parsers. Build on #662's
`rs.ArraySlice` and slice helpers, adding no new pointer form, per m3's
[unsafe policy](/quest/m3/README.md).

Decided with the maintainer on 2026-11-07: ✅ plan it, in m3 (from #662's follow-ups).

Public API: the translator's output.