Skip to content

Commit

Permalink
Mention creation of disjoint Querys with Without<T> in conflicting …
Browse files Browse the repository at this point in the history
…access Panic (bevyengine#2413)

# Objective

Beginners semi-regularly appear on the Discord asking for help with using `QuerySet` when they have a system with conflicting data access.
This happens because the Resulting Panic message only mentions `QuerySet` as a solution, even if in most cases `Without<T>` was enough to solve the problem.

## Solution

Mention the usage of `Without<T>` to create disjoint queries as an alternative to `QuerySet`

## Open Questions

- Is `disjoint` a too technical/mathematical word?
- Should `Without<T>` be mentioned before or after `QuerySet`?
  - Before: Using `Without<T>` should be preferred and mentioning it first reinforces this for a reader.
  - After: The Panics can be very long and a Reader could skip to end and only see the `QuerySet`


Co-authored-by: MinerSebas <[email protected]>
  • Loading branch information
2 people authored and ostwilkens committed Jul 27, 2021
1 parent bc1f4a1 commit 6c2e379
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ fn assert_component_access_compatibility(
.map(|component_id| world.components.get_info(component_id).unwrap().name())
.collect::<Vec<&str>>();
let accesses = conflicting_components.join(", ");
panic!("Query<{}, {}> in system {} accesses component(s) {} 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.",
panic!("Query<{}, {}> in system {} accesses component(s) {} in a way that conflicts with a previous system parameter. Allowing this would break Rust's mutability rules. Consider using `Without<T>` to create disjoint Queries or merging conflicting Queries into a `QuerySet`.",
query_type, filter_type, system_name, accesses);
}

Expand Down

0 comments on commit 6c2e379

Please sign in to comment.