Skip to content

Use the fully qualified name for Component in the require attribute #16377

@venhelhardt

Description

@venhelhardt

Bevy version

The release number or commit hash of the version you're using.
7477928

What you did

Tried to compile this sample code:

#[derive(::bevy::ecs::component::Component, Default)]
pub struct A;

#[derive(::bevy::ecs::component::Component)]
#[require(A)]
pub struct B;

What went wrong

Compiler emits an error

11 | #[derive(::bevy::ecs::component::Component)]
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
   |
   = note: this error originates in the derive macro `::bevy::ecs::component::Component` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing this trait
   |
1  + use bevy::prelude::Component;

Additional information

Problematic line:

<#ident as Component>::register_required_components(

Instead of <#ident as Component> it should be <#ident as #bevy_ecs_path::component::Component>

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-BugAn unexpected or incorrect behaviorS-Needs-TriageThis issue needs to be labelled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions