Skip to content

bevy_reflect_derive 0.10.0 > 0.10.1 has a breaking change for recursion #8965

Closed
@Aultus-defora

Description

@Aultus-defora

Bevy version

0.10.1

If you cannot get Bevy to build or run on your machine, please include:

  • the Rust version 1.70.0 (ec8a8a0ca 2023-04-25)
  • MacOS Ventura 13.4

What you did

In 0.10.0 version struct and enum that could be recursive with #[cfg_attr(debug_assertions, derive(FromReflect, Reflect))] working,
but with 0.10.1 bevy_reflect_derive it does not even compile with a overflow evaluating the requirement RecurEnum: FromReflect

What went wrong

I expected the automatic update from 0.10.0 to 0.10.1 to not have breaking change
Wonder if the issue is that 'Reflect' was never intended to be used this way to begin with

Additional information

Other information that can be used to further reproduce or isolate the problem.
Here is the simplified code that used to compile in 0.10.0 but doesn't in 0.10.1

use bevy::{
    prelude::*,
    reflect::{FromReflect, Reflect},
};

#[cfg_attr(debug_assertions, derive(FromReflect, Reflect))]
enum RecurEnum {
    RecurStruct(RecurStruct),
    Const(f64)
}
#[cfg_attr(debug_assertions, derive(FromReflect, Reflect))]
pub struct RecurStruct {
    vector: Vec<RecurEnum>,
}

also old lock that allows this code to compile

Cargo.lock.txt

P.S. adding cargo tolm that makes the example work by forcing bevy_reflect_derive to be 0.10.0
Cargo.toml.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ReflectionRuntime information about typesC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions