Mention creation of disjoint Querys with Without<T> in conflicting access Panic (#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 <66798382+MinerSebas@users.noreply.github.com>
This commit is contained in:
MinerSebas 2021-07-01 20:20:11 +00:00
parent 46cae5956f
commit b911a005d9

View file

@ -180,7 +180,7 @@ fn assert_component_access_compatibility(
.map(|component_id| world.components.get_info(component_id).unwrap().name()) .map(|component_id| world.components.get_info(component_id).unwrap().name())
.collect::<Vec<&str>>(); .collect::<Vec<&str>>();
let accesses = conflicting_components.join(", "); 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); query_type, filter_type, system_name, accesses);
} }