Skip to content

Incorrect handling of EntityRef/Mut Queries + Resources resulting in false conflicts #13139

Description

@iiYese

Bevy version

0.13

What you did

Have a system with EntityRef & ResMut<T>.

What went wrong

System should not have any access conflicts but it does.

Additional information

Minimal example to reproduce:

use bevy::prelude::*;

#[derive(Resource)]
struct Foo;

fn sys(_: Query<EntityRef>, _: ResMut<Foo>) {}

fn main() {
    App::new()
        .insert_resource(Foo)
        .add_systems(Update, sys)
        .run();
}
thread 'main' panicked at /home/yogii/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_ecs-0.13.2/src/system/system_param.rs:542:13:
error[B0002]: ResMut<bevy_bug::Foo> in system bevy_bug::sys conflicts with a previous Res<bevy_bug::Foo> access. Consider removing the duplicate access.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-BugAn unexpected or incorrect behaviorS-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!

    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