bevyengine / bevyengine/bevy

`Component` derive macro does not work with `#![feature(default_field_values)]` structs

Open
#19,325 5 comments 0 reactions 0 assignees View on GitHub
C-Bug C-Dependencies S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.16

## What you did

I've turned on `#![feature(default_field_values)]` for the crate and wanted to specify default values for my component struct. Like:

```rust
#[derive(Component, Default)]
pub struct ConveyorBelt {
pub speed: f32 = 1.0, // I get "expected ','" message here
}
```

## What went wrong

It appears that `#[derive(Component)]` does not work for structs which have default values in their declared fields.

## Additional information

The main problem is that the diagnostics is very vague. I couldn't figure out that the issue is in Component derive implementation.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.