bevyengine / bevyengine/bevy

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

Open
#10,393 1 comment 1 reaction 0 assignees View on GitHub
A-Reflection C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## Bevy version

v0.12

## What you did

```rust
#[derive(Reflect)]
pub struct Foo {
pub problem: Option>,
}
```

## What went wrong

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

## Additional information

This was compiling on v0.11.

Contributor guide

Open the contributing guide

Research direction

Reproduce the generic #[derive(Reflect)] example on Bevy v0.12 and inspect the Reflect derive and TypePath handling for Option>. Compare the behavior with v0.11; done means the example compiles again for T: Reflect without the Box: TypePath error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.