Skip to content

Fix Component macro hook composition codegen#24039

Merged
alice-i-cecile merged 3 commits into
bevyengine:mainfrom
grind086:fix-multi-hook
Apr 30, 2026
Merged

Fix Component macro hook composition codegen#24039
alice-i-cecile merged 3 commits into
bevyengine:mainfrom
grind086:fix-multi-hook

Conversation

@grind086

Copy link
Copy Markdown
Contributor

Objective

#24000 introduced the ability to use both relationships and user-provided hooks with #[derive(Component)], but the hook function that is generated when there's a conflict does not compile.

Solution

Remove an errant nested quote!, and change the inline function definition to a closure so that Self type references work.

Testing

Updated the test to check the rest of the hooks, and it passes with this fix.

@alice-i-cecile alice-i-cecile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable fix; thanks for the regression test!

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Apr 30, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 30, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in ECS Apr 30, 2026
Merged via the queue into bevyengine:main with commit 234875d Apr 30, 2026
45 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in ECS Apr 30, 2026
@grind086 grind086 deleted the fix-multi-hook branch April 30, 2026 00:45
tychedelia pushed a commit to processing/bevy that referenced this pull request Apr 30, 2026
# Objective

bevyengine#24000 introduced the ability to use both relationships and
user-provided hooks with `#[derive(Component)]`, but the hook function
that is generated when there's a conflict does not compile.

## Solution

Remove an errant nested `quote!`, and change the inline function
definition to a closure so that `Self` type references work.

## Testing

Updated the test to check the rest of the hooks, and it passes with this
fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants