mirror of
https://github.com/bevyengine/bevy
synced 2024-12-24 03:53:06 +00:00
parent
e77efcc8d7
commit
410f3c478a
3 changed files with 22 additions and 16 deletions
|
@ -3,6 +3,7 @@ use crate::storage::SparseSetIndex;
|
||||||
use crate::world::World;
|
use crate::world::World;
|
||||||
use core::{fmt, fmt::Debug, marker::PhantomData};
|
use core::{fmt, fmt::Debug, marker::PhantomData};
|
||||||
use derive_more::derive::From;
|
use derive_more::derive::From;
|
||||||
|
use disqualified::ShortName;
|
||||||
use fixedbitset::FixedBitSet;
|
use fixedbitset::FixedBitSet;
|
||||||
|
|
||||||
/// A wrapper struct to make Debug representations of [`FixedBitSet`] easier
|
/// 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 {
|
pub(crate) fn format_conflict_list(&self, world: &World) -> String {
|
||||||
match self {
|
match self {
|
||||||
AccessConflicts::All => String::new(),
|
AccessConflicts::All => String::new(),
|
||||||
AccessConflicts::Individual(indices) => format!(
|
AccessConflicts::Individual(indices) => indices
|
||||||
" {}",
|
|
||||||
indices
|
|
||||||
.ones()
|
.ones()
|
||||||
.map(|index| world
|
.map(|index| {
|
||||||
|
format!(
|
||||||
|
"{}",
|
||||||
|
ShortName(
|
||||||
|
world
|
||||||
.components
|
.components
|
||||||
.get_info(ComponentId::get_sparse_set_index(index))
|
.get_info(ComponentId::get_sparse_set_index(index))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.name())
|
.name()
|
||||||
.collect::<Vec<&str>>()
|
)
|
||||||
.join(", ")
|
)
|
||||||
),
|
})
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join(", "),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1573,7 +1573,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = "error[B0001]: Query<bevy_ecs::world::entity_ref::EntityMut, ()> 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<T>` to create disjoint Queries or merging conflicting Queries into a `ParamSet`. See: https://bevyengine.org/learn/errors/b0001"
|
expected = "error[B0001]: Query<EntityMut, ()> 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<T>` 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 assert_world_and_entity_mut_system_does_conflict() {
|
||||||
fn system(_query: &World, _q2: Query<EntityMut>) {}
|
fn system(_query: &World, _q2: Query<EntityMut>) {}
|
||||||
|
@ -1582,7 +1582,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = "error[B0001]: Query<bevy_ecs::world::entity_ref::EntityMut, ()> 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<T>` to create disjoint Queries or merging conflicting Queries into a `ParamSet`. See: https://bevyengine.org/learn/errors/b0001"
|
expected = "error[B0001]: Query<EntityMut, ()> 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<T>` 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 assert_entity_ref_and_entity_mut_system_does_conflict() {
|
||||||
fn system(_query: Query<EntityRef>, _q2: Query<EntityMut>) {}
|
fn system(_query: Query<EntityRef>, _q2: Query<EntityMut>) {}
|
||||||
|
@ -1591,7 +1591,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_panic(
|
#[should_panic(
|
||||||
expected = "error[B0001]: Query<bevy_ecs::world::entity_ref::EntityMut, ()> 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<T>` to create disjoint Queries or merging conflicting Queries into a `ParamSet`. See: https://bevyengine.org/learn/errors/b0001"
|
expected = "error[B0001]: Query<EntityMut, ()> 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<T>` 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 assert_entity_mut_system_does_conflict() {
|
||||||
fn system(_query: Query<EntityMut>, _q2: Query<EntityMut>) {}
|
fn system(_query: Query<EntityMut>, _q2: Query<EntityMut>) {}
|
||||||
|
|
|
@ -28,6 +28,7 @@ use core::{
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
};
|
};
|
||||||
|
use disqualified::ShortName;
|
||||||
|
|
||||||
use super::Populated;
|
use super::Populated;
|
||||||
use variadics_please::all_tuples;
|
use variadics_please::all_tuples;
|
||||||
|
@ -354,7 +355,7 @@ fn assert_component_access_compatibility(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let accesses = conflicts.format_conflict_list(world);
|
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<T>` 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<T>` 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
|
// SAFETY: Relevant query ComponentId and ArchetypeComponentId access is applied to SystemMeta. If
|
||||||
|
|
Loading…
Reference in a new issue