Skip to content

Component/Relationship derive uses a non fully qualified path #21980

@HeartofPhos

Description

@HeartofPhos

Bevy 0.17.3

mod test {
    fn derive_component_relationship_hygiene() {
        #[derive(Debug, bevy::prelude::Component)]
        #[relationship(relationship_target = RelTarget)]
        struct Rel(pub bevy::prelude::Entity);

        #[derive(Debug, bevy::prelude::Component)]
        #[relationship_target(relationship = Rel)]
        struct RelTarget(bevy::prelude::Entity);
    }
}

throws the compile time error

error[E0412]: cannot find type `Entity` in this scope
   --> examples\ecs\message.rs:148:25
    |
148 |         #[derive(Debug, bevy::prelude::Component)]
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
    |
    = note: this error originates in the derive macro `bevy::prelude::Component` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these structs
    |
147 +     use crate::Entity;
    |
147 +     use bevy::prelude::Entity;
    |
147 +     use bevy_ecs::prelude::Entity;
    |
147 +     use bevy_internal::prelude::Entity;
    |

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions