diff --git a/crates/bevy_ecs/src/query/access.rs b/crates/bevy_ecs/src/query/access.rs index 00167383fe..a0e311ab3d 100644 --- a/crates/bevy_ecs/src/query/access.rs +++ b/crates/bevy_ecs/src/query/access.rs @@ -3,6 +3,7 @@ use crate::storage::SparseSetIndex; use crate::world::World; use core::{fmt, fmt::Debug, marker::PhantomData}; use derive_more::derive::From; +use disqualified::ShortName; use fixedbitset::FixedBitSet; /// A wrapper struct to make Debug representations of [`FixedBitSet`] easier @@ -888,18 +889,22 @@ impl AccessConflicts { pub(crate) fn format_conflict_list(&self, world: &World) -> String { match self { AccessConflicts::All => String::new(), - AccessConflicts::Individual(indices) => format!( - " {}", - indices - .ones() - .map(|index| world - .components - .get_info(ComponentId::get_sparse_set_index(index)) - .unwrap() - .name()) - .collect::>() - .join(", ") - ), + AccessConflicts::Individual(indices) => indices + .ones() + .map(|index| { + format!( + "{}", + ShortName( + world + .components + .get_info(ComponentId::get_sparse_set_index(index)) + .unwrap() + .name() + ) + ) + }) + .collect::>() + .join(", "), } } diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs index cd2452bcbc..394e03c205 100644 --- a/crates/bevy_ecs/src/system/mod.rs +++ b/crates/bevy_ecs/src/system/mod.rs @@ -1573,7 +1573,7 @@ mod tests { #[test] #[should_panic( - expected = "error[B0001]: Query in system bevy_ecs::system::tests::assert_world_and_entity_mut_system_does_conflict::system accesses component(s) 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" + expected = "error[B0001]: Query in system bevy_ecs::system::tests::assert_world_and_entity_mut_system_does_conflict::system accesses component(s) 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" )] fn assert_world_and_entity_mut_system_does_conflict() { fn system(_query: &World, _q2: Query) {} @@ -1582,7 +1582,7 @@ mod tests { #[test] #[should_panic( - expected = "error[B0001]: Query in system bevy_ecs::system::tests::assert_entity_ref_and_entity_mut_system_does_conflict::system accesses component(s) 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" + expected = "error[B0001]: Query in system bevy_ecs::system::tests::assert_entity_ref_and_entity_mut_system_does_conflict::system accesses component(s) 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" )] fn assert_entity_ref_and_entity_mut_system_does_conflict() { fn system(_query: Query, _q2: Query) {} @@ -1591,7 +1591,7 @@ mod tests { #[test] #[should_panic( - expected = "error[B0001]: Query in system bevy_ecs::system::tests::assert_entity_mut_system_does_conflict::system accesses component(s) 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" + expected = "error[B0001]: Query in system bevy_ecs::system::tests::assert_entity_mut_system_does_conflict::system accesses component(s) 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" )] fn assert_entity_mut_system_does_conflict() { fn system(_query: Query, _q2: Query) {} diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 5c6055a0e2..7519a1e30a 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -28,6 +28,7 @@ use core::{ marker::PhantomData, ops::{Deref, DerefMut}, }; +use disqualified::ShortName; use super::Populated; use variadics_please::all_tuples; @@ -354,7 +355,7 @@ fn assert_component_access_compatibility( return; } let accesses = conflicts.format_conflict_list(world); - panic!("error[B0001]: Query<{query_type}, {filter_type}> 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"); + 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