Skip to content

ReadOnlyFetch is not implimented for With<T> #2665

@tom-leys

Description

@tom-leys

Bevy version

bevy_ecs 0.5.0

Operating system & version

Windows 10, GCC

What you did

    {
    // SpaceShip is a component, sector.space() is a &mut World
        (|(mut commands, query) : (Commands, Query<(Entity, With<SpaceShip>)>)|
        {
            for entity in query.iter() {
                commands.entity(entity).despawn();
            }

        }).system().run((), &mut sector.space())
    }

What you expected to happen

All queries which involve states (With, Without, Changed) should be read-only.

What actually happened

Did not compile

--> sg_simulation\src\network\sync\test_sector.rs:704:37
|
704 | for entity in query.iter() {
| ^^^^ the trait ReadOnlyFetch is not implemented for WithFetch<&ship_component::SpaceShip>
|
= note: required because of the requirements on the impl of ReadOnlyFetch for (EntityFetch, WithFetch<&ship_component::SpaceShip>)

Additional information

Non-critical, I can use iter_mut. With #2305 I would not have noticed this issue at all.

Is perhaps similar to #763

Does this bug mean that I can't run two queries using With<SpaceShip> at the same time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-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