Repository navigation
t27b: _ = p; for a parameter lowers to nothing where the reference compiles it (Closes #7057) - #7111
Merged
Merged
Conversation
Refs #6063. Dogfood spec first: specs/tri/t27b/conformance/param_discard.t27 holds scalar, struct, slice-neighbour, in-branch and all-parameter discards, plus a discard in a fn no test calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #6063. A discard of a parameter that the body names nowhere else, and that no module declaration shares, lowers to nothing. Every other discard of a parameter is refused as StmtAssign(discard): - one the body also reads, which Zig's AstGen refuses as a pointless discard in every fn; - a second discard of the same parameter; - a parameter gen-zig renames because a module declaration shares its name. Owner-approved foreign edit (label owner-approved-foreign on #6063), listed in tools/policy/foreign-exceptions.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oses #7057) Refs #6063. The reference's dead-store pass drops every top-level `_ = <no call>;` from a fn body. gen-zig then discards the parameter itself when nothing else reads it. So the statement is as if absent, including next to a read of `p` and when written twice. Only a nested `_ = p;` is printed as written, and only that one can be a pointless discard. The spec and tests now cover both cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…7057) Refs #6063. The lab showed that the reference compiles a nested `_ = p;` when the body names `p` only in discards: repeated, in both arms, after a top-level discard, or for a parameter that shares a module declaration's name. Zig refuses it only as a pointless discard, that is next to a real use of `p`. t27b now refuses exactly that case, and the spec and tests cover the discards that compile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #7057) Refs #6063. With `_ = frame;` lowered, t27b reaches this spec for the first time, and its interpreter faults in build_content_frame: the fn returned a slice of its own local `[256]u8`, which dangles once it returns. The reference's Zig and t27b's JIT read the dead stack by luck (jit Ok(1), interpreter "1-byte access outside every live slot"). The buffer is now a `[]u8` parameter the test owns, as gen_escape does; the reference still gives 7 pass, 0 vacuous, and t27b gives 7 pass with no JIT/interpreter mismatch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #6063. leaderboard, queen-rehearsal and the new param_discard conformance spec move to pass. dqn now stops at ExprCall(undeclared fn) and gen_gradient at StmtExpr statement. Not-pass goes from 52 to 50. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 6, 2026 20:56
This was referenced Oct 6, 2026
Contributor
This was referenced Oct 6, 2026
Ledger conflict: both conformance entries kept, counts recounted (pass 488, not-pass 48). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 6, 2026
Open
Contributor
PR DashboardGenerated at: 2026-10-06 21:59:49 UTC
Summary
Seal Status
|
This was referenced Oct 6, 2026
Merged
Merged
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.
Refs #6063. Closes #7057.
What
A port that keeps a parameter for its interface writes
_ = p;. The reference compiles it, but t27b treated_as an assignment target and refused the file withStmtAssign(undeclared)._ = p;wherepis a parameter of the current fn now lowers to nothing. The rule follows what the reference does, which the lab measured:_ = p; // unused by the spec bodyif needed, or renamesptop_argwhen a module declaration shares its name. t27b always accepts it there.p. t27b counts the body's mentions ofpand its_ = p;statements, and refuses the nested discard only when the two counts differ.if, after a top-level discard, or for a parameter that shares a module declaration's name._ = x;for a local or an undeclared name is still refused (StmtAssign(undeclared)).Dogfood spec first
specs/tri/t27b/conformance/param_discard.t27has 7 tests: scalar, struct and slice parameters, a discard in a branch, every parameter discarded, a top-level discard next to a read, and nested discards alone.t27c test-report): 7 pass, 0 vacuous.StmtAssign(discard).StmtAssign(discard)). There is no case where t27b and the reference disagree.A dangling slice found on the way
With the discard lowered, t27b reaches
queen-rehearsal.t27for the first time, and its interpreter faulted inbuild_content_frame. That fn returned a slice of its own local[256]u8, which dangles once the fn returns. The reference's Zig and t27b's JIT read the dead stack by luck: the corpus showed a JIT/interpreter mismatch. The spec now takes a caller-owned buffer, asgen_escapedoes. The reference still gives 7 pass with 0 vacuous, and t27b gives 7 pass with no mismatch.Numbers (Railway lab, same reference, same time)
check_fix_carries_source, a reference flake)param_discard.t27,leaderboard.t27,queen-rehearsal.t27(after the spec fix).d_g22_testmoved from timeout to pass; that is load noise.zig not on PATH(EAGAIN) under load. They lower the reference count on that side only and do not change any t27b verdict.dqn.t27now stops atExprCall(undeclared fn)andgen_gradient.t27atStmtExpr statement.hex.t27is unchanged. Its first blocker isExprStructLit(value ignored).cargo test -p t27bon the lab, on the merged tree eac7077: 14 suites, 118 passed, 0 failed. The lib'stests_hir_roundtripuart and bridge tests fail as they do on master: they resolve../specsfromcli/t27b, and the lib istest = false.Foreign-code approval
The owner approved this Rust edit: label
owner-approved-foreignis on #6063, and the owner said "add the label yourself and do the work" (translated). The edits are minimal and confined tocli/t27b/src/lower.rsandcli/t27b/tests/source.rs. Both files are listed intools/policy/foreign-exceptions.txt.🤖 Generated with Claude Code