Skip to content

t27c: lower t27 ** array repeat to Zig @splat (fixes local Zig 0.17.1 build of t27core) - #13595

Merged
gHashTag merged 4 commits into
masterfrom
lane/t27c-zig-spacing
Nov 10, 2026
Merged

gHashTag merged 4 commits into
masterfrom
lane/t27c-zig-spacing

Conversation

@gHashTag

@gHashTag gHashTag commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #13591.

Root cause

Zig has no ** repeat operator: zig 0.17.1 reads .{ 0 } ** n as .{ 0 } * (* n) and refuses the generated t27core. All four Zig emission sites lowered the t27 repeat verbatim.

Fix

  • Value initializers [_]T{ v } ** n and .{ v } ** n lower to @splat(v) (the count rides the target type).
  • The pointer form lowers to a comptime block that tiles the pattern, then takes the address.
  • Multi-element patterns fail loudly with @compileError instead of emitting invalid **.
  • FROZEN_HASH resealed (the spec compiles again); core_t27core.json recomputed without --force.

Evidence

  • t27c test specs/compiler/core/t27core.t27: 114/114 (previously a hard compile failure)
  • t27c+t27b parser_fixtures: 6/6 each
  • t27b test specs/compiler/core/t27core.t27: 114/114
  • Variants tested empirically against zig 0.17.1 (all ** spellings rejected; @Splat and comptime-blk forms accepted)

Note

Medium Risk
Touches core Zig code generation and bootstrap compiler sealing; behavior change is localized to repeat/suffix lowering but affects all generated t27core Zig output.

Overview
Fixes #13591 by changing the Zig backend so t27 array repeat forms no longer emit invalid ** (which Zig 0.17.1 rejects). Single-element repeats now lower to @splat(...), with repeat count carried by the target type; pointer/repeat fields use a comptime block to tile the pattern; multi-element ** lowers to @compileError. Embedded thread runtime initialization switches from ** 256 to @splat(null).

Rust numeric suffix stripping and type_base_name are moved out of hand-written compiler.rs into a new specs/compiler/rust_num_suffix.t27 spec and generated rust_num_suffix module, which the Zig emitter calls when normalizing literals like 0i32.

core_t27core.json is resealed for Zig 0.17.1 (114/114 tests); FROZEN_HASH for bootstrap/src/compiler.rs is updated.

Reviewed by Cursor Bugbot for commit 6f8b6e2. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: f13dc2ca-6556-49b5-986f-e918f3a279d7)

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-10 18:46:16 UTC

Summary

Status Count
Total Open PRs 35
PRs with Failing Checks 29
PRs with All Checks Green 6
READY 0
FAILING 29
PENDING 0
NO CHECKS YET 1

These columns do not partition: 0 + 29 + 0 + 1 = 30, and there are 35 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=700c1592d3ea != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@cursor

cursor Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: ba9d5dc5-70f1-4059-8d65-0e4f4cac9187)

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-10 18:50:21 UTC

Summary

Status Count
Total Open PRs 35
PRs with Failing Checks 29
PRs with All Checks Green 6
READY 0
FAILING 29
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 29 + 0 + 0 = 29, and there are 35 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=700c1592d3ea != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@cursor

cursor Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: f7c2bc5b-2fa6-455e-bc8d-cf7d158e5248)

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-10 18:59:09 UTC

Summary

Status Count
Total Open PRs 34
PRs with Failing Checks 31
PRs with All Checks Green 3
READY 0
FAILING 31
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 31 + 0 + 0 = 31, and there are 34 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=700c1592d3ea != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@cursor

cursor Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: d924843a-5c41-4e7e-a491-7c0130240805)

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-10 19:23:32 UTC

Summary

Status Count
Total Open PRs 34
PRs with Failing Checks 31
PRs with All Checks Green 3
READY 0
FAILING 31
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 31 + 0 + 0 = 31, and there are 34 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=c850fb7383ef != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag force-pushed the lane/t27c-zig-spacing branch from feee360 to 9f9ea36 Compare November 10, 2026 19:24
@cursor

cursor Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 1fd75769-0b6c-4c48-b0e2-061a7e22a945)

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-10 19:24:58 UTC

Summary

Status Count
Total Open PRs 34
PRs with Failing Checks 31
PRs with All Checks Green 3
READY 0
FAILING 31
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 31 + 0 + 0 = 31, and there are 34 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=c850fb7383ef != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

Zig has no ** repeat operator: zig 0.17.1 read .{ 0 } ** n as
.{ 0 } * (* n) and refused the generated t27core. All four Zig emission
sites lower the repeat to valid Zig: @Splat for value forms, a comptime
tiling block for the pointer form, and a loud @CompileError for
multi-element patterns.

Refs #13591
Resealed without --force: the spec compiles and passes 114/114 under both
backends.

Refs #13591
strip_rust_num_suffix and type_base_name move to own language
(specs/compiler/rust_num_suffix.t27, 9 tests) with gen-rust mounts; the
hand-written bodies are deleted, keeping compiler.rs net-negative.

Refs #13591, #5980
@gHashTag
gHashTag force-pushed the lane/t27c-zig-spacing branch from 9f9ea36 to 6f8b6e2 Compare November 10, 2026 19:29
@cursor

cursor Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: 1fcff976-3345-4566-8823-2196ba06e247)

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-11-10 19:30:01 UTC

Summary

Status Count
Total Open PRs 34
PRs with Failing Checks 31
PRs with All Checks Green 3
READY 0
FAILING 31
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 31 + 0 + 0 = 31, and there are 34 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=c850fb7383ef != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 99067e5 into master Nov 10, 2026
48 of 54 checks passed
@gHashTag
gHashTag deleted the lane/t27c-zig-spacing branch November 10, 2026 19:37
gHashTag added a commit that referenced this pull request Nov 11, 2026
)

The recovery branch predates #13595; carrying its pre-@Splat seals made
spec-guards report core_t27core stale. Sync compiler.rs, FROZEN_HASH,
rust_num_suffix gen/spec, and the three affected seals to master's
current state so the branch is self-consistent and seal-current.

Refs #13591, #13595
gHashTag added a commit that referenced this pull request Nov 11, 2026
)

The recovery branch predates #13595; carrying its pre-@Splat seals made
spec-guards report core_t27core stale. Sync compiler.rs, FROZEN_HASH,
rust_num_suffix gen/spec, and the three affected seals to master's
current state so the branch is self-consistent and seal-current.

Refs #13591, #13595

Refs #13592
gHashTag added a commit that referenced this pull request Nov 11, 2026
…Zig @Splat repeat lowering to the 0.16-valid ** form, regen search_cmd gen under its canonical spec (Closes #13602)

- L2 GENERATION: gen/rust/tri/search_cmd.rs mapped to the deleted flat
  specs/tri/search_cmd.t27. Regenerated byte-identical output from the
  canonical specs/tri/search_cmd/search_cmd.t27 into
  gen/rust/tri/search_cmd/search_cmd.rs and repointed the one reader
  (cli/tri/src/main.rs) to it.
- seal currency (spec-guards): #13595 (99067e5) rewrote the four Zig
  repeat-emission sites to @Splat, which
  (a) drifted 386 seals and
  (b) does not compile under the reference toolchain zig 0.16.0 for the
  untyped-local repeat (no result type to splat into) and for the
  conformance specs that pin the .{ v } ** n behavior -- 203 specs
  refused to re-seal. bootstrap/src/compiler.rs reverted to the
  99067e5^ emission; zig 0.16 (pinned locally and in CI) accepts
  .{ v } ** n typed and untyped (measured with build-exe probes).
  The 0.17.1 local t27core build this traded away is the price; filed
  for the owner to weigh. FROZEN_HASH reminted twice during the work.
- specs/compiler/rust_num_suffix.t27: the t27o port was missing the
  usize width suffix (7usize stayed 7usize; the hand-written original
  stripped it). Branch + test added, gen-rust regenerated; 10/10 tests.

Verified locally (zig 0.16 on PATH):
- check_seal_currency: 3396 seals, STALE generated-code hash 0, exit 0.
- check_seal_coverage: OK, 113 known-broken all in seal_baseline.txt.
- dupe_scan: exit 0, no new group, none grown.
- l2_regen_check --base origin/master: ok (after commit).

Closes #13602
gHashTag added a commit that referenced this pull request Nov 11, 2026
…piler (Refs #13592)

The #13595 lowering changed the NOT-LOWERED test count in gen-rust
headers (18 -> 19); the checked-in copies for die_binding, bench_boards,
independence, corpus_receipt and ddc_receipt were never regenerated, so
the_checked_in_rust_is_what_gen_rust_writes_from_the_spec drifted on any
branch that rebuilds bootstrap. t27c gen-rust output, byte-exact; the
test now passes 9/9 locally.
gHashTag added a commit that referenced this pull request Nov 11, 2026
…Refs #13591, #13592)

The rust_num_suffix table covered i/u 8-128 but not usize itself, so
`[7usize; 3]` splatted as `@splat(7usize)` and Zig refused it with
"invalid digit 'u' for decimal base" -- the repeat_width_suffix
conformance spec stayed red since #13595. usize joins the table first
(longest-match order kept), the element-literal splat path strips
through the same t27 helper, and the conformance spec now passes 14/14
under zig 0.16.0. adagrad and corpus_merkle regression-tested.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(t27c): Zig 0.17.1 rejects gen-c spacing in generated t27core

1 participant