Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Deduplicate ambiguity reporting code #6149

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 9 additions & 35 deletions crates/bevy_ecs/src/schedule/ambiguity_detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,42 +47,16 @@ impl SystemOrderAmbiguity {
) -> Self {
use SystemStageSegment::*;

// TODO: blocked on https://github.com/bevyengine/bevy/pull/4166
// We can't grab the system container generically, because .parallel_systems()
// and the exclusive equivalent return a different type,
// and SystemContainer is not object-safe
let (system_a_name, system_b_name) = match segment {
Parallel => {
let system_container = stage.parallel_systems();
(
system_container[system_a_index].name(),
system_container[system_b_index].name(),
)
}
ExclusiveAtStart => {
let system_container = stage.exclusive_at_start_systems();
(
system_container[system_a_index].name(),
system_container[system_b_index].name(),
)
}
ExclusiveBeforeCommands => {
let system_container = stage.exclusive_before_commands_systems();
(
system_container[system_a_index].name(),
system_container[system_b_index].name(),
)
}
ExclusiveAtEnd => {
let system_container = stage.exclusive_at_end_systems();
(
system_container[system_a_index].name(),
system_container[system_b_index].name(),
)
}
let systems = match segment {
Parallel => stage.parallel_systems(),
ExclusiveAtStart => stage.exclusive_at_start_systems(),
ExclusiveBeforeCommands => stage.exclusive_before_commands_systems(),
ExclusiveAtEnd => stage.exclusive_at_end_systems(),
};

let mut system_names = [system_a_name.to_string(), system_b_name.to_string()];
let mut system_names = [
systems[system_a_index].name().to_string(),
systems[system_b_index].name().to_string(),
];
system_names.sort();

let mut conflicts: Vec<_> = component_ids
Expand Down