#[entities] should error when put on a enum variant
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
hello !
## Bevy version
bevy 0.16.0
If your bug is rendering-related, copy the adapter info that appears when you run Bevy.
## What you did
```rust
#[derive(Component)]
pub enum TroopState {
Idle,
#[entities] // should error
Run(Option),
#[entities] // should error
Attack(Target),
}
#[derive(Component)]
pub struct Target {
#[entities]
pub entity: Entity,
}
```
`Target` is not mapped, this is a footgun, without any warning
## What went wrong
the `#[entities]` should be on the associated type like so `Run(#[entities] Option)`
maybe the derive macro can error when the annotation is on the enum variant instead of actual type ?
Contributor guide
Research direction
Start by reproducing the enum example with #[derive(Component)] and the #[entities] annotations on variants and fields. Inspect the Component derive handling for enum variants; done means an annotation placed on a variant produces an error while the annotation on the associated type remains accepted.
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
- 45/100