Repository navigation
feat(ts): translate Debug of Bound, Ordering, Reverse, and ControlFlow - #331
Merged
Merged
Conversation
Quest-Claim: aaecd0d836ba8120
Each writes its derived Debug: a variant with a field passes the formatter's options to it, and one without writes its name unpadded. A ControlFlow is written however it is held, the Err or None `?` breaks with included, and `!` and Infallible, which never exist, are never written. iters::range_methods now prints its bounds by Debug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # ts/fixtures/lang/expected/harness.ts # ts/fixtures/lang/src/harness.rs
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
{:?}of aBound<T>orBound<&T>, such as a range'sstart_bound(), was refused (unsupported call to <std::ops::Bound<&u8> as std::fmt::Debug>::fmt), so #325 encoded bounds as bytes.Ordering,Reverse, andControlFlowwere refused the same way, and so wasDebugof!/Infallible, which aControlFlowthat?breaks with, or aResult<_, Infallible>, reaches.Approach
fmt::std_implmaps each to its derivedDebug:rt.fmtBound,rt.fmtOrdering,Reversethroughrt.fmtDebugTupleFields, andrt.fmtControlFlow/rt.fmtControlFlowOptionfor each way aControlFlowis held (Result, theErr?breaks with, or theOptionit was applied to, withrt.Nonewhere needed). A field takes the formatter's options; a variant without one writes its name unpadded.!(andInfallible, which is it here) writes throughrt.unreachable, since none exists.iters::range_methodsprints its bounds by{:?};bound_ofis gone.fmt::enumscovers{:?},{:#?},{:x?},{:#X?}, width, fill, sign and zero-pad overBound<u8>,Bound<&str>,Bound<char>,Bound<Option<u8>>,Bound<&[u8]>,Bound<&Clip>viaas_ref, range bounds,Ordering, nestedReverse, andControlFlowin every representation. It runs in the lang differential against native wasm32.Audit: the range types,
RangeFull, andWrapping(from #326, merged in here) already translated.Impact
{:?}of these types now translates instead of being refused. No public Rust API change.Alternatives
fmtControlFlow(continues, f, go, stop)with thunks: TypeScript can't narrow theResultread inside them, so the runtime narrows instead.Follow-ups
Review
Codex
gpt-6.1-sol, medium effort, viaquest review --base origin/main. Round 1 on0a653eb3found nothing. Round 2 ran on the reviewed head3d2f9457de95c520f055a14c6b57bff510015de6, after merging origin/main with a hand-resolved conflict in the harness case list, and found nothing.Local checks:
just cipasses on3d2f9457.(written by Claude Opus 5.5)
🤖 Generated with Claude Code