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.
- [`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
- [A Pin of a crate's own Deref type](/quest/m3/ts-pin-own-deref.md) - `Pin<P>` over a crate's own `Deref` derefs through its impl and type-checks
19 changes: 19 additions & 0 deletions quest/m3/ts-pin-own-deref.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# [S] A Pin of a crate's own Deref type type-checks

## Goal

[rust2-ts](/ts/README.md) translates a `Pin<P>` whose `P` is a crate's own `Deref` type,
such as `Pin::new(OwnPtr(Cell::new(0)))` with `old.get()` called through it, into
TypeScript that type-checks, its deref going through `P`'s own `Deref` impl, proven by
differential tests against native Rust. Today `tsc` rejects it (TS2739), since `Pin<P>`'s
deref is typed as `P` itself.

## Plan

Found on [#621](https://github.com/moq-dev/rust2/pull/621) while checking a review finding.
It is safe Rust, where m3's [unsafe policy](/quest/m3/README.md) puts translation effort,
though no consumer at the moq pin reaches it.

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

Public API: the translator's output.