Fix E0229 in the IntoWasmAbi expansion for constrained generics - #89
Merged
Conversation
wip: correcting output fix: test
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>
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.
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_abiinterpolated a rawsyn::Genericsinto the type position of a where predicate.Generics::to_tokensemits the declaration form, bounds included, sostruct S<T: Constraint>producedS<T: Constraint>: Serialize— E0229.Changes on top of #72
split_for_impl().1instead of the hand-built strippedGenerics. 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 ',').TypeGenericsis syn's type-position rendering and covers all three parameter kinds, which also drops ~20 lines.T: Iterator<Item = u32>— the associated-item constraint E0229 is named for.Verified: the three added shapes compile with this change, and two of them panic the derive without it.
🤖 Generated with Claude Code