bevyengine / bevyengine/bevy

Queries: `Added<Foo>` in filter position conflicts with `&mut Foo` in query position

Open
#4,624 7 comments 1 reaction 0 assignees View on GitHub
A-ECS C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version
* 0.6
* 0.7

## Code

```rust
use bevy::prelude::*;

#[derive(Component)]
struct A;
#[derive(Component)]
struct B;
fn main() {
App::new().add_system(hello_world_system).run();
}

fn hello_world_system(aaas: Query<&A, Added>, bees: Query<&mut B>) {
println!("hello world");
}
```

### What should happen

`cargo run` this should print "hello world". As I never access `B` in `aaas`, there should be no conflict between `bees` and `aaas`.

### What happened instead

```
thread 'main' panicked at 'error[B0001]: Query<&mut bevy_exclusion_bug::B, ()> in system bevy_exclusion_bug::hello_world_system accesses component(s) bevy_exclusion_bug::B in a way that conflicts with a previous system parameter. Consider using `Without` to create disjoint Queries or merging conflicting Queries into a `ParamSet`.', /home/gibonus/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs-0.7.0/src/system/system_param.rs:173:5
```

## Additional information

Initially found out by @linkmauve in https://github.com/nicopap/ui-navigation/issues/21. I'm fairly certain the example worked at one point without crashing. I'll investigate further and report here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.