Skip to content

bevy_reflect: Fix FromReflect derive for opaque remote wrappers #19158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MrGVSV
Copy link
Member

@MrGVSV MrGVSV commented May 10, 2025

Objective

Fixes #19017

Solution

The FromReflect derive logic for opaque types was not properly accounting for remote reflection. This PR fixes that by making it downcast to the remote type and then converting it back to the wrapper.

Testing

You can test locally by running:

cargo test -p bevy_reflect

@MrGVSV MrGVSV force-pushed the mrgvsv/reflect/fix-opaque-remote-fromreflect branch from cbdbf8e to db00d9d Compare May 10, 2025 06:41
@MrGVSV MrGVSV added C-Bug An unexpected or incorrect behavior A-Reflection Runtime information about types D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Macros Code that generates Rust code labels May 10, 2025
@MrGVSV MrGVSV moved this from Open to In Progress in Reflection May 10, 2025
@MrGVSV MrGVSV force-pushed the mrgvsv/reflect/fix-opaque-remote-fromreflect branch from db00d9d to 6333480 Compare May 10, 2025 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Bug An unexpected or incorrect behavior D-Macros Code that generates Rust code D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

#[reflect(opaque)] remote type fails to register at runtime, making ReflectSerializer unusable
1 participant