Skip to content

fix(rust): the type parameter was in the AST, dropped in three places (+13) - #3235

Merged
gHashTag merged 3 commits into
masterfrom
generic-params-dropped
Sep 5, 2026
Merged

gHashTag merged 3 commits into
masterfrom
generic-params-dropped

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

The parser keeps the type-parameter list — ArrayView(T) arrives as
params: ["T: "] — and the Rust emitter dropped it while keeping every use of the
parameter. 19 specs generated a struct whose fields name a type nothing declares.

The class needed all three positions, and each alone was worth nothing

step accepts gain
master 275
+ pub struct Name<T> on the declaration 275 +0
+ <T> on free functions that use it 276 +1
+ Name(T) → Name<T> at every type use 288 +13

Zero regressions at every step.

The declaration alone changes nothing because the module-level free functions still
name T; both together change almost nothing because the uses keep the
call-style spelling, and rustc says so precisely — "parenthesized type parameters may
only be used with a Fn trait"
in 12 of the 19.

No sibling had the answer this time

C has no generics and writes struct ArrayView; the Zig emitter drops the parameter
too. The mapping is still forced rather than chosen: the spec declares a type
parameter and <T> is how Rust spells one. The parameter names come from the AST,
not from a guess about single capital letters — and the whole-word matcher exists so a
struct named Trit cannot be matched by a parameter named T.

Two predictions, both off, and why

Predicted +12 to +19 for the first two steps because the class is 100%
stub-bodied
(94 of 94 functions). Measured +1. Then predicted +6 to +12 for
the third and measured +13.

The stub-share predictor from #3219 is an upper bound that only applies once every
site of the class is repaired
— it says what the class could yield, never what a
partial repair will. A partial repair of a class yields roughly nothing, which is the
older lesson: a defect class is not closed until every position it occupies is
enumerated.

Closes #3234

… (+13)

The parser keeps the list -- `ArrayView(T)` arrives as `params: ["T: "]` -- and
this emitter dropped it while keeping every use, so 19 specs generated a struct
whose fields name a type nothing declares.

The class did not close until all three positions were repaired, and each alone
was worth almost nothing:

    pub struct Name<T> on the declaration        275 -> 275   +0
    <T> on free functions that use it            275 -> 276   +1
    Name(T) -> Name<T> at every type USE         275 -> 288   +13

Zero regressions at every step, measured by spec name. The declaration alone
changes nothing because the module-level free functions still name `T`; both
together change almost nothing because the uses keep the call-style spelling, and
rustc says so precisely -- "parenthesized type parameters may only be used with a
`Fn` trait" -- in 12 of the 19.

No sibling backend had the answer here: C has no generics and the Zig emitter
drops the parameter too. The mapping is forced rather than chosen. Names come from
the AST, and a whole-word matcher keeps a struct named `Trit` from being matched by
a parameter named `T`.

Also corrects my own predictor. The stub-share rule of #3219 is an upper bound that
applies only once every site is repaired: predicted +12..+19 for the first two
steps and measured +1, then predicted +6..+12 for the third and measured +13.

Seal and 38 drifted seals move in the same commit.

Closes #3234

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) September 5, 2026 02:41
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

1 similar comment
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-05 02:54:15 UTC

Summary

Status Count
Total Open PRs 17
PRs with Failing Checks 12
PRs with All Checks Green 5
READY 1
FAILING 12
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=2d58d9d3160d != 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).

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-05 02:55:02 UTC

Summary

Status Count
Total Open PRs 17
PRs with Failing Checks 12
PRs with All Checks Green 5
READY 1
FAILING 12
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=2d58d9d3160d != 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).

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-05 03:00:06 UTC

Summary

Status Count
Total Open PRs 17
PRs with Failing Checks 11
PRs with All Checks Green 6
READY 1
FAILING 11
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=2d58d9d3160d != 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 6d9ea8d into master Sep 5, 2026
33 of 34 checks passed
@gHashTag
gHashTag deleted the generic-params-dropped branch October 26, 2026 06:15
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.

The type parameter is in the AST and the Rust emitter dropped it — in three positions, not one

1 participant