From bfa6553f9cc66510453837d3007ae337f8dd1c49 Mon Sep 17 00:00:00 2001 From: SpecificProtagonist Date: Tue, 17 Dec 2024 20:06:31 +0100 Subject: [PATCH] Fix typo in B0001 message (#16860) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Objective Example error message beforehand: ``` error[B0001]: Query<&mut Data, ()> in system bevytest::main::{{closure}} accesses component(s)Data in a way that conflicts with a previous… ``` --- crates/bevy_ecs/src/system/system_param.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 2186e2b8a3..b7cf1bd16d 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -354,8 +354,12 @@ fn assert_component_access_compatibility( if conflicts.is_empty() { return; } - let accesses = conflicts.format_conflict_list(world); - panic!("error[B0001]: Query<{}, {}> in system {system_name} accesses component(s){accesses} in a way that conflicts with a previous system parameter. Consider using `Without` to create disjoint Queries or merging conflicting Queries into a `ParamSet`. See: https://bevyengine.org/learn/errors/b0001", ShortName(query_type), ShortName(filter_type)); + let mut accesses = conflicts.format_conflict_list(world); + // Access list may be empty (if access to all components requested) + if !accesses.is_empty() { + accesses.push(' '); + } + panic!("error[B0001]: Query<{}, {}> in system {system_name} accesses component(s) {accesses}in a way that conflicts with a previous system parameter. Consider using `Without` to create disjoint Queries or merging conflicting Queries into a `ParamSet`. See: https://bevyengine.org/learn/errors/b0001", ShortName(query_type), ShortName(filter_type)); } // SAFETY: Relevant query ComponentId and ArchetypeComponentId access is applied to SystemMeta. If