Skip to content

Commit

Permalink
Remove ambiguity sets (bevyengine#5916)
Browse files Browse the repository at this point in the history
# Objective

Ambiguity sets are used to ignore system order ambiguities between groups of systems. However, they are not very useful: they are clunky, poorly integrated, and generally hampered by the difficulty using (or discovering) the ambiguity detector.

As a first step to the work in bevyengine#4299, we're removing them.

## Migration Guide

Ambiguity sets have been removed.
  • Loading branch information
alice-i-cecile authored and james7132 committed Oct 28, 2022
1 parent 21d7c12 commit 4b0e839
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 496 deletions.
15 changes: 0 additions & 15 deletions crates/bevy_ecs/macros/src/lib.rs
Expand Up @@ -462,21 +462,6 @@ pub fn derive_stage_label(input: TokenStream) -> TokenStream {
derive_label(input, &trait_path, "stage_label")
}

/// Generates an impl of the `AmbiguitySetLabel` trait.
///
/// This works only for unit structs, or enums with only unit variants.
/// You may force a struct or variant to behave as if it were fieldless with `#[ambiguity_set_label(ignore_fields)]`.
#[proc_macro_derive(AmbiguitySetLabel, attributes(ambiguity_set_label))]
pub fn derive_ambiguity_set_label(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let mut trait_path = bevy_ecs_path();
trait_path.segments.push(format_ident!("schedule").into());
trait_path
.segments
.push(format_ident!("AmbiguitySetLabel").into());
derive_label(input, &trait_path, "ambiguity_set_label")
}

/// Generates an impl of the `RunCriteriaLabel` trait.
///
/// This works only for unit structs, or enums with only unit variants.
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_ecs/src/lib.rs
Expand Up @@ -34,9 +34,9 @@ pub mod prelude {
event::{EventReader, EventWriter, Events},
query::{Added, AnyOf, ChangeTrackers, Changed, Or, QueryState, With, Without},
schedule::{
AmbiguitySetLabel, ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion,
RunCriteria, RunCriteriaDescriptorCoercion, RunCriteriaLabel, Schedule, Stage,
StageLabel, State, SystemLabel, SystemSet, SystemStage,
ExclusiveSystemDescriptorCoercion, ParallelSystemDescriptorCoercion, RunCriteria,
RunCriteriaDescriptorCoercion, RunCriteriaLabel, Schedule, Stage, StageLabel, State,
SystemLabel, SystemSet, SystemStage,
},
system::{
adapter as system_adapter, Commands, In, IntoChainSystem, IntoExclusiveSystem,
Expand Down
8 changes: 1 addition & 7 deletions crates/bevy_ecs/src/schedule/label.rs
@@ -1,4 +1,4 @@
pub use bevy_ecs_macros::{AmbiguitySetLabel, RunCriteriaLabel, StageLabel, SystemLabel};
pub use bevy_ecs_macros::{RunCriteriaLabel, StageLabel, SystemLabel};
use bevy_utils::define_label;

define_label!(
Expand All @@ -13,12 +13,6 @@ define_label!(
/// Strongly-typed identifier for a [`SystemLabel`].
SystemLabelId,
);
define_label!(
/// A strongly-typed class of labels used to identify sets of systems with intentionally ambiguous execution order.
AmbiguitySetLabel,
/// Strongly-typed identifier for an [`AmbiguitySetLabel`].
AmbiguitySetLabelId,
);
define_label!(
/// A strongly-typed class of labels used to identify [run criteria](crate::schedule::RunCriteria).
RunCriteriaLabel,
Expand Down

0 comments on commit 4b0e839

Please sign in to comment.