Skip to content

Cannot derive Reflect on a struct with Option<Box<T>> field where T: Reflect #10393

@umut-sahin

Description

@umut-sahin

Bevy version

v0.12

What you did

#[derive(Reflect)]
pub struct Foo<T: Reflect> {
    pub problem: Option<Box<T>>,
}

What went wrong

error[E0277]: the trait bound `std::boxed::Box<T>: TypePath` is not satisfied
  --> src/bug.rs:5:18
   |
25 |     pub problem: Option<Box<T>>,
   |                  ^^^^^^^^^^^^^^ the trait `TypePath` is not implemented for `std::boxed::Box<T>`
   |

Additional information

This was compiling on v0.11.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ReflectionRuntime information about typesC-UsabilityA targeted quality-of-life change that makes Bevy easier to use

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions