File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
crates/bevy_ecs/src/schedule Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ pub use system_container::*;
20
20
pub use system_descriptor:: * ;
21
21
pub use system_set:: * ;
22
22
23
+ use std:: fmt:: Debug ;
24
+
23
25
use crate :: {
24
26
system:: { IntoSystem , System } ,
25
27
world:: World ,
@@ -144,14 +146,19 @@ impl Schedule {
144
146
stage_label : impl StageLabel ,
145
147
system : impl Into < SystemDescriptor > ,
146
148
) -> & mut Self {
149
+ // Use a function instead of a closure to ensure that it is codegend inside bevy_ecs instead
150
+ // of the game. Closures inherit generic parameters from their enclosing function.
151
+ #[ cold]
152
+ fn stage_not_found ( stage_label : & dyn Debug ) -> ! {
153
+ panic ! (
154
+ "Stage '{:?}' does not exist or is not a SystemStage" ,
155
+ stage_label
156
+ )
157
+ }
158
+
147
159
let stage = self
148
160
. get_stage_mut :: < SystemStage > ( & stage_label)
149
- . unwrap_or_else ( move || {
150
- panic ! (
151
- "Stage '{:?}' does not exist or is not a SystemStage" ,
152
- stage_label
153
- )
154
- } ) ;
161
+ . unwrap_or_else ( move || stage_not_found ( & stage_label) ) ;
155
162
stage. add_system ( system) ;
156
163
self
157
164
}
You can’t perform that action at this time.
0 commit comments