Repository navigation
feat(ts): translate Debug of VecDeque and std's maps and sets - #312
Merged
Merged
Conversation
Quest-Claim: daa373d1049afca0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
marked this pull request as ready for review
October 30, 2026 23:31
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
format!("{q:?}")of aVecDeque<T>refused withunsupported call to <VecDeque<T> as Debug>::fmtand a span (found by #303). Auditing the rest of std's collections showed thatHashMap,HashSet,BTreeMap, andBTreeSetare refused the same way.Vec,BinaryHeap, slices, arrays, andBox<[T]>already translated.Approach
fmt.rsmaps each collection'sDebugto its iterator, as std's impls do: a deque tort.fmtList(rt.dequeIter(q)), so items come from its head however the buffer wraps; a set tort.fmtSetover its keys; a map tort.fmtMapover its entries.rt.fmtSetis std'sDebugSet, which is itsDebugListin braces.rt.fmtMapwrites each entry as a single set entry: key,": ", then value, through onePadAdapter, as std'sDebugMapdoes in pretty mode.fmt::collectionscase in thelangfixture runs differentially against native wasm32. It covers a deque driven by random push/pop at both ends; a deque wrapped bypush_frontand then popped from the back past the buffer's start; empty deques, maps, and sets;VecDeque<()>; nested deques;{:#?},{:x?}, and width; elements with customDebug(Hex) andOption<u8>elements; and B-tree maps of deques. To check that the new case is covered, I brokefmtMap's": ": the differential failed with 212 differences.ts/README.mdnow says that a collection'sDebugfollows its iteration order.Impact
{:?}ofVecDeque,HashMap,HashSet,BTreeMap, andBTreeSetnow translates instead of being refused.rt.fmtSetandrt.fmtMap.Alternatives
rt.DebugSet/rt.DebugMapbuilders. Not done: no translated code callsf.debug_set()orf.debug_map()yet, so these are plain functions overDebugList.Follow-ups
slice::Iter,vec::IntoIter, the B-tree and hash iterators,Chars,Bytes, andvec_deque::Iter, whoseDebugwrites its two ring-buffer slices (andVecDeque::as_slices, also refused). These are refused for a different reason: each writes its own wrapper text.Choices made without asking: I fixed maps and sets in this PR because they are refused the same way, and recorded iterators and
LinkedListas quests.Review
Codex (
quest review), gpt-6.1-sol, medium effort, round 1 on headae2f61b7a9236402b0bba23f8f8a67b30602bfc7againstorigin/mainfba78a4a: no findings.just cipassed locally on that head.🤖 Generated with Claude Code
(written by Claude Opus 5.5)