Skip to content

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

Open
@yackimoff

Description

@yackimoff

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:

#[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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorC-DependenciesA change to the crates that Bevy depends onS-BlockedThis cannot move forward until something else changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions