Repository navigation
t27b: an array repeat's value loses its Rust width suffix, as gen-zig prints it (Closes #7813) - #8689
Merged
Merged
Conversation
… prints it (Closes #7813) The t27c parser keeps `[v; n]` as the text "v;n". gen-zig prints the value through strip_rust_num_suffix (see #6451), so `[0i32; 2]` is `.{ 0 } ** 2` and the array type gives the width. t27b parsed the value back as written and refused `0i32` as ExprLiteral(literal). specs/tri/t27b/literal_plan.t27 now holds gen-zig's rule (`repeat_value_len`): the suffixes usize isize u128 i128 u64 i64 u32 i32 u16 i16 f64 f32 u8 i8 in that order; the first one the text ends with whose remainder (one `_` dropped, one leading `-` skipped) starts with a digit and holds only digits, `.` and `_` is cut. The glue in repeat_lit parses back only that much: one changed line, net hand lines 0. Conformance spec: specs/tri/t27b/conformance/repeat_width_suffix.t27 (14 tests, one per suffix the t27c lexer reads plus a negated value and a named count; 17 runtime asserts in t27b, 14/14 in the reference, none vacuous). zig_field_syntax.t27 and trinity_loss/src/lib.t27 now pass; max_not_pass 24 -> 22. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 10, 2026 16:01
Contributor
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.
Closes #7813
What
specs/compiler/zig_field_syntax.t27andspecs/port/trios/crates/trinity_loss/src/lib.t27pass the reference, but t27b refused them asExprLiteral(literal)on[0i32; 2],[1i8; 64]and[-1i8; 64].The t27c parser keeps an array repeat
[v; n]as the textv;n. gen-zig prints the value throughstrip_rust_num_suffix(see #6451), which drops a Rust width suffix:[0i32; 2]becomes.{ 0 } ** 2, and the array type gives the width. t27b parsed the value back as written and refused0i32.How
specs/tri/t27b/literal_plan.t27adds gen-zig's rule asrepeat_value_len. It triesusize isize u128 i128 u64 i64 u32 i32 u16 i16 f64 f32 u8 i8in that order. The first suffix the text ends with is cut if the remainder starts with a digit and holds only digits,.and_(one_before the suffix is dropped and one leading-is skipped first). The plan has 4 new tests; 41 runtime asserts in t27b. It is generated witht27c gen-rustintogen/rust/tri/t27b/literal_plan.rs, which is already mounted aslp.repeat_litincli/t27b/src/lower.rsparses back only the part the plan keeps. One line changed, so the net hand-line count is 0.const R = 0i32;keeps its suffix in gen-zig too, and Zig refuses it, so t27b still refuses it.Evidence (t27c lab, zig 0.16.0, t27b under qemu-aarch64)
specs/tri/t27b/conformance/repeat_width_suffix.t27has 14 tests, one per suffix the t27c lexer reads, plus a negated value and a named count.t27c test-report: 14/14 pass, none vacuous.t27b test --check: 14 passed, 17 runtime asserts.t27b test --check):zig_field_syntax.t27: 2/2 pass, 6 runtime asserts.trinity_loss/src/lib.t27: 7/7 pass, 7 runtime asserts.t27b corpus specsbefore and after (1805 files). Only four files moved:pass;pass;literal_plan.t27, from 4 to 8 tests.cargo test --release -p t27b: all green.check_budgetandcheck_all, built from master'sgen/c/policy/own_language.c, both exit 0.Ledger
docs/reports/t27b_expectations.json:pass, and the conformance spec has a newpassrow.max_not_passgoes from 24 to 22.Seals:
t27b_T27bLiteralPlan.json(updated) andconformance_T27bConformanceRepeatWidthSuffix.json(new).🤖 Generated with Claude Code