Repository navigation
feat(ts): translate &mut dyn Debug and &mut dyn Display - #453
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
enabled auto-merge (squash)
November 2, 2026 21:13
This was referenced Nov 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A
&dyn Debugor&dyn Display, and since #445 aBox,Arc, orRcof one, translate as a function writing the value, but a&mut dyn Debugor&mut dyn Displaywas refused as "a coercion to&mut dyn Debug, which is not supported yet". The trait objects quest names it. moq builds none; this is std coverage the quest calls for.Approach
A
&mut dyn Debugor&mut dyn Displayis the same function a&dynone is.Debug::fmtandDisplay::fmttake&self, so nothing writes through the borrow. A value JS copies is read through itsrt.Placeas the function writes, not as it is made, so it shows what the place holds then. The change is one line:fmt_objectaccepts either mutability of reference.Tests:
fmt::objectsin the lang fixture's differential test against native wasm32 now also covers:Vec<&mut dyn Debug>of a number and aStringthat JS copies, the crate's type, aBox<dyn Debug>, and a tuple holding the crate's type over aCell. Each is written with{:?}and{:#?}.Cellset while the borrows live, then written again through a reborrowed&mut dyn Debugand a&dyn Debugcoerced from it.&mut dyn Displayof a number written after the number changes, of the crate's type centered, and of aStringafter apush.Census at the moq pin, before → after: unchanged (692 / 186 / 119 for moq-net / model / kio), since moq builds none.
Impact
&mut dyn Debugand&mut dyn Displaytranslate instead of failing.Alternatives
Follow-ups
Debugof aCellis refused, asDebugof aRefCellis (quest/m3/ts-refcell-debug.md, from #447). Met writing the fixture; the fixture writes the cell through the crate's own wrapper.String + &stris an "unsupported call", met in a scratch test: new questquest/m3/ts-string-add.md.Review
Codex
gpt-6.1-solat medium effort, viaquest review, round 1 on head5e7bb518e42eb51a5681431456e74e5d41bb7454: no findings. Headbfb9718cadds only thets-string-addquest;just checkpasses.🤖 Generated with Claude Code