Skip to content

Multiple Querys with mut acces and changed filters cant be used without QuerySet #1791

Description

@MinerSebas

Bevy version

d6bc414

Operating system & version

Windows 10

What you did

I wanted to remove a QuerySet that seemed unneeded, but then Bevy Panicked: https://github.com/bevyengine/bevy/blob/main/crates/bevy_render/src/camera/camera.rs#L70-L73

I then reduced it to this minimal example:

use bevy::prelude::*;

fn main() {
    App::build().add_system(test_system.system()).run();
}

struct TestStruct;

fn test_system(
    mut query1: Query<(Entity, &mut TestStruct)>,
    query2: Query<Entity, Added<TestStruct>>,
) {

}

What you expected to happen

The minimum example should not Panic.

What actually happened

It Panicked, while claiming the system would break Rust's mutability rules, which it cant:
thread 'main' panicked at 'Query<bevy_ecs::entity::Entity, bevy_ecs::query::filter::Added<hello_world::TestStruct>> in system &hello_world::test_system accesses component(s) hello_world::TestStruct in a way that conflicts with a previous system parameter. Allowing this would break Rust's mutability rules. Consider merging conflicting Queries into a QuerySet.', crates\bevy_ecs\src\system\system_param.rs:144:5

Additional information

Bisecting the Repo, the example Panics after #1525 was merged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorS-Needs-DesignThis issue requires design work to think about how it would best be accomplished

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions