@@ -19,6 +19,7 @@ use crate::{
19
19
query:: Access ,
20
20
schedule:: { is_apply_deferred, BoxedCondition , ExecutorKind , SystemExecutor , SystemSchedule } ,
21
21
system:: BoxedSystem ,
22
+ warn_system_skipped,
22
23
world:: { unsafe_world_cell:: UnsafeWorldCell , World } ,
23
24
} ;
24
25
@@ -527,13 +528,6 @@ impl ExecutorState {
527
528
conditions : & mut Conditions ,
528
529
world : UnsafeWorldCell ,
529
530
) -> bool {
530
- // Short circuit when system cannot be executed
531
- // TODO: move validation before checking system access
532
- if !system. validate_param ( world. world ( ) ) {
533
- // TODO: Warn about system skipping.
534
- return false ;
535
- }
536
-
537
531
let mut should_run = !self . skipped_systems . contains ( system_index) ;
538
532
539
533
for set_idx in conditions. sets_with_conditions_of_systems [ system_index] . ones ( ) {
@@ -559,8 +553,6 @@ impl ExecutorState {
559
553
self . evaluated_sets . insert ( set_idx) ;
560
554
}
561
555
562
- // TODO: short circuit if system is skipped after system set conditions.
563
-
564
556
// Evaluate the system's conditions.
565
557
// SAFETY:
566
558
// - The caller ensures that `world` has permission to read any data
@@ -576,6 +568,19 @@ impl ExecutorState {
576
568
577
569
should_run &= system_conditions_met;
578
570
571
+ // SAFETY:
572
+ // - The caller ensures that `world` has permission to read any data
573
+ // required by the system.
574
+ // - `update_archetype_component_access` has been called for system.
575
+ let valid_params = unsafe { system. validate_param_unsafe ( world) } ;
576
+
577
+ if !valid_params {
578
+ warn_system_skipped ! ( "System" , system. name( ) ) ;
579
+ self . skipped_systems . insert ( system_index) ;
580
+ }
581
+
582
+ should_run &= valid_params;
583
+
579
584
should_run
580
585
}
581
586
@@ -733,22 +738,22 @@ unsafe fn evaluate_and_fold_conditions(
733
738
conditions : & mut [ BoxedCondition ] ,
734
739
world : UnsafeWorldCell ,
735
740
) -> bool {
736
- // TODO: move validation before checking system access
737
- if !conditions
738
- . iter ( )
739
- . all ( |condition| condition. validate_param ( world. world ( ) ) )
740
- {
741
- // TODO: Warn about system skipping.
742
- return false ;
743
- }
744
-
745
741
// not short-circuiting is intentional
746
742
#[ allow( clippy:: unnecessary_fold) ]
747
743
conditions
748
744
. iter_mut ( )
749
745
. map ( |condition| {
750
- // SAFETY: The caller ensures that `world` has permission to
751
- // access any data required by the condition.
746
+ // SAFETY:
747
+ // - The caller ensures that `world` has permission to read any data
748
+ // required by the condition.
749
+ // - `update_archetype_component_access` has been called for condition.
750
+ if !unsafe { condition. validate_param_unsafe ( world) } {
751
+ warn_system_skipped ! ( "Condition" , condition. name( ) ) ;
752
+ return false ;
753
+ }
754
+ // - The caller ensures that `world` has permission to read any data
755
+ // required by the condition.
756
+ // - `update_archetype_component_access` has been called for condition.
752
757
unsafe { __rust_begin_short_backtrace:: readonly_run_unsafe ( & mut * * condition, world) }
753
758
} )
754
759
. fold ( true , |acc, res| acc && res)
0 commit comments