Repository navigation
t27b: @intCast as an array index or a slice bound takes Zig's usize, from int_cast_plan.t27 (Closes #7902) - #7905
Merged
Merged
Conversation
…from int_cast_plan.t27 (Closes #7902) Part of #6063 (t27b coverage), item C10 of #6488. Zig gives an index and each bound of a slice the result type usize, so `POW2[@intcast(e - 1)]` converts e as `@as(usize, @intcast(e))` would: an i64 is checked and a negative one traps, a u8 widens, a usize is kept, a literal folds. int_cast_plan.t27 names that type (INDEX_TYPE) and its tests show plan's answers there; the glue lowers such an index through the existing int_cast. specs/numeric/ocp_mx.t27 passes 49/49. - specs/tri/t27b/conformance/int_cast_index.t27: ocp_mx's shapes, 5 tests, reference 5/5, 0 vacuous. - cli/t27b/tests/int_cast_traps.t27: a negative index traps at the cast. - Glue: 11 added lines in lower.rs, 1 in tests/tail.rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
This was referenced Oct 8, 2026
Contributor
This was referenced Oct 8, 2026
AGENTS.md keeps #7819's line and re-measures this PR's after it (wc -l); the ledger keeps both new conformance rows, counts 923 / 151 / 35. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
Contributor
PR DashboardGenerated at: 2026-10-08 20:31:19 UTC
Summary
Seal Status
|
AGENTS.md keeps #7803's line and re-measures this PR's after it (wc -l); the ledger's counts are recounted from its rows: 925 / 151 / 34. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 8, 2026
Merged
…ed (Closes #7902) Master brings #8028. The only conflict was the AGENTS.md remainder line, re-measured with wc -l. The ledger merged without a conflict, but both sides had lowered max_not_pass by one to the same text; it is recounted from the rows (18). Hand lines under cli/t27b against 325b0b1: net -5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
13 tasks
…ed (Closes #7902) Master brings #8258 (lower.rs's body walks move to ast_walk.t27). Conflicts were the AGENTS.md remainder line (re-measured with wc -l) and the ledger (rows kept from both sides, max_not_pass recounted from the rows). Hand lines under cli/t27b against ab5b3b7: net -5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 9, 2026
Contributor
PR DashboardGenerated at: 2026-10-09 20:48:56 UTC
Summary
Seal Status
|
Contributor
PR DashboardGenerated at: 2026-10-09 21:02:21 UTC
Summary
Seal Status
|
This was referenced Oct 9, 2026
Merged
…ed (Closes #7902) Master brings #8350 (lower.rs's node scans move to ast_scan.t27). The only conflict was the AGENTS.md remainder line, re-measured with wc -l; max_not_pass is recounted from the rows. Hand lines under cli/t27b against e4338f4: net -5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 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.
Closes #7902. Part of #6063 (t27b coverage), item C10 of #6488.
Decision
specs/numeric/ocp_mx.t27passes the reference (49 of 49) and t27b refused it at 42 sites ofExprCall(@intCast), every one an array index (POW2[@intCast(e - 1)],KIND_TOP[@intCast(kind)]). #7627 gave@intCasta result type only from@as, a typed binding, a parameter or areturn.In Zig 0.16 an index, and each bound of a slice, has the result type
usize. Soa[@intCast(k)]converts k exactly as@as(usize, @intCast(k))does: an i64 or an i32 is checked and a negative value is a safety panic; a u8 or a u32 widens; a usize is kept; a literal folds, and a negative literal is a compile error. t27b now lowers it the same way:specs/tri/t27b/int_cast_plan.t27names the type (INDEX_TYPE,usize). A new test showsplan's answers for an index: CHECK for i64 and i32, WIDEN for u8 and u32, KEEP for usize, FOLD or REFUSE_LITERAL for a literal, TRUNCATE in wrap mode.usize_operand) sends an@intCastindex or slice bound through the existingint_castwith that type. It makes no decision of its own. Every other index is lowered as before.@intCastas an arithmetic operand (x + @intCast(k)) still has no result type. Zig refuses it, and t27b keeps refusing it.Evidence
Reference:
t27c test-reporton the t27c lab, zig 0.16.0. t27b: aarch64 under qemu, built from this branch.specs/numeric/ocp_mx.t27ExprCall(@intCast)specs/tri/t27b/conformance/int_cast_index.t27(new)specs/tri/t27b/int_cast_plan.t27cli/t27b/tests/int_cast_traps.t27gainsict_negative_index_expect_trap. It traps at the@intCastline (TrapKind::Cast), before the bounds check, in the interpreter and the JIT. Zig's Debug build panics there. A truncating cast would trap at the bounds check instead, so the test would catch it.INDEX_TYPEasisizefailsint_cast_traps_outside_its_result_type.cargo test --release -p t27b(aarch64, qemu): every suite passes, exit 0.int_cast_plan.t27andconformance/int_cast_index.t27saved, then verified (all hashes MATCH).check_budget()andcheck_all()(with master'sforeign-exceptions.txt) exit 0 on this diff.ocp_mx.t27moves from blocked to pass, and the new conformance row is added.Budget port (strict gate, see #8236)
The strict budget lets hand-written code under
cli/t27bonly shrink:Ty::can_widen_fromincli/t27b/src/ir.rswas a hand copy of Zig's lossless integer widening rule.specs/tri/t27b/int_cast_plan.t27already holds that rule aswidens, with its partial-order test over the eight integer types. The method's body is now one call of the generatedwidens.lower.rs'sicmount becomespub(crate)soir.rsreaches it.ir.rs: +2 -12.usize_operand, this PR's index glue, is one line shorter.Hand lines under
cli/t27bagainst master: +12 -17, net -5.Lines by file (
git diff --numstat --no-renames origin/master...HEAD)cli/t27b/src/ir.rscli/t27b/src/lower.rscli/t27b/tests/tail.rsgen/rust/tri/t27b/int_cast_plan.rst27c gen-rust)specs/tri/t27b/int_cast_plan.t27specs/tri/t27b/conformance/int_cast_index.t27cli/t27b/tests/int_cast_traps.t27.trinity/seals/*(2, schema 2),docs/reports/t27b_expectations.json,AGENTS.mdGates and checks (t27c lab, tree merged with master cde548e)
check_budget()overgit diff --numstat --no-renames cde548ecd...HEAD, built from cde548e'sgen/c/policy/own_language.c: exit 0.check_all()with cde548e'stools/policy/foreign-exceptions.txtand the name-status: exit 0.cargo test --release -p t27b(aarch64 under qemu): 14 suites ok, 0 failed.t27c gen-rustofint_cast_plan.t27with that tree's t27c is byte-identical to the committed file.int_cast_planwith its 12 tests;seal --verify: all hashes MATCH.wc -l: 14758 plus 1222, tests 8284, against master cde548e's 14763 plus 1222 and 8284.t27b corpus specsover master's tree, master's t27b against this branch's: exactly one file changes,specs/numeric/ocp_mx.t27, from blocked (ExprCall(@intCast)) to pass (49 tests, 116 asserts). Of 1731 files, no other changes.t27b lab: signed receipt (#7686)
Head 9c10b0f is this branch merged with master 3ac8bef (which brings #8252, see #8248). It is requested on the t27b lab with a fresh 32-byte challenge. The base is a signed run of master 3ac8bef, requested with its own challenge because the lab had no run of that commit. The compare will be posted here when both runs are in.
The 3ac8bef merge resolved only the
AGENTS.mdline, re-measured withwc -l. Its tree was checked again on the t27c lab:cargo test --release -p t27b14 suites ok,gen-rustbyte-identical,seal --verifyall hashes MATCH,check_budget()andcheck_all()(3ac8bef's gate files) exit 0.Earlier receipt (before the budget port)
Base 76836e2 (master, the lab's own signed run). Head d659b89, this PR's change on that base, requested from the t27b lab with a fresh challenge (#7686). The compare was run on t27b-lab from
/work/t27as/work/t27c-master corpus-receipt compare BASE HEAD --challenge-head <challenge>:Exit 3, IMPROVED_ONLY.
cargo test --release -p t27b(aarch64, qemu)Commits after d659b89. These are merges of master and nothing else: 8dee18c / e87e790, 430c522, 408d740, e66473f 4270760, 2dfe978, 6b6386e, 09ffc2f, 12ee225, 6cd8fba 35e6996 and a97cb9e. They change no file of this PR except AGENTS.md's remainder line and the ledger. AGENTS.md is re-measured with
wc -lafter the lines master added. In the ledger, master's rows and this PR's are kept. Since master's #7862 (see #7859), the ledger stores no counts, onlymax_not_pass(25 now). After each merge, the merged tree was built on the t27c lab, andcargo test --release -p t27bpassed there (14 suites), with ocp_mx at 49/49.Native arm64 (
t27b-native-ratchet, ubuntu-24.04-arm, the reference built natively): reference disagree 0. Its red verdict is master's own findings (MOVED and UNEXPECTED PASS lines on other specs, the same on master). No line names a file of this PR.Generated with Claude Code