Skip to content

Fix E0229 in the IntoWasmAbi expansion for constrained generics - #89

Merged
madonoharu merged 4 commits into
mainfrom
pr72-work
Aug 17, 2026
Merged

Fix E0229 in the IntoWasmAbi expansion for constrained generics#89
madonoharu merged 4 commits into
mainfrom
pr72-work

Conversation

@madonoharu

Copy link
Copy Markdown
Owner

Supersedes #72 by @dsgallups, whose commits are preserved here — rebased onto main, with two changes on top. That branch has "Allow edits from maintainers" off, so this could not be pushed there.

The bug

expand_into_wasm_abi interpolated a raw syn::Generics into the type position of a where predicate. Generics::to_tokens emits the declaration form, bounds included, so struct S<T: Constraint> produced S<T: Constraint>: Serialize — E0229.

Changes on top of #72

  • split_for_impl().1 instead of the hand-built stripped Generics. The hand-rolled version clears bounds on type params only, so <'a: 'b, 'b> and <const N: usize> still reached the type position and panicked the derive (expected ','). TypeGenerics is syn's type-position rendering and covers all three parameter kinds, which also drops ~20 lines.
  • Test cases for the two shapes that still failed, plus T: Iterator<Item = u32> — the associated-item constraint E0229 is named for.
  • Regenerated snapshot, now that Fix expand tests and harden the scheduled workflows #87 has landed and expansions are complete (498 → 2160 lines).

Verified: the three added shapes compile with this change, and two of them panic the derive without it.

🤖 Generated with Claude Code

The hand-built stripped `Generics` only clears bounds on type params, so
`<'a: 'b, 'b>` and `<const N: usize>` still reached the type position and
panicked the derive ("expected `,`"). `split_for_impl().1` is syn's
type-position rendering, which handles all three param kinds.

Verified: the three added cases compile with this change and two of them
panic without it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@madonoharu madonoharu self-assigned this Aug 17, 2026
@madonoharu
madonoharu merged commit 269b3dd into main Aug 17, 2026
3 checks passed
@madonoharu
madonoharu deleted the pr72-work branch August 17, 2026 08:39
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.

2 participants