Skip to content

Commit 8ea4c58

Browse files
committed
fix errors
1 parent 5202c4e commit 8ea4c58

File tree

6 files changed

+133
-148
lines changed

6 files changed

+133
-148
lines changed

crates/bevy_app/src/app.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,6 @@ impl App {
235235

236236
// reassemble
237237
*self = App::from_parts(sub_apps, tls, send, recv, runner);
238-
239-
self.remove_tls_channel();
240238
}
241239

242240
/// Runs the [`App`] by calling its [runner](Self::set_runner).
@@ -930,7 +928,7 @@ fn run_once(mut app: App) {
930928
// wait for plugins to finish setting up
931929
let plugins_state = app.plugins_state();
932930
if plugins_state != PluginsState::Cleaned {
933-
while app.plugins_state() == PluginsState::Adding {
931+
while app.plugins_state() != PluginsState::Ready {
934932
#[cfg(not(target_arch = "wasm32"))]
935933
bevy_tasks::tick_global_task_pools_on_main_thread();
936934
}

crates/bevy_app/src/schedule_runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl Plugin for ScheduleRunnerPlugin {
6969
// wait for plugins to finish setting up
7070
let plugins_state = app.plugins_state();
7171
if plugins_state != PluginsState::Cleaned {
72-
while app.plugins_state() == PluginsState::Adding {
72+
while app.plugins_state() != PluginsState::Ready {
7373
#[cfg(not(target_arch = "wasm32"))]
7474
bevy_tasks::tick_global_task_pools_on_main_thread();
7575
}

crates/bevy_ecs/macros/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,6 @@ pub fn impl_param_set(_input: TokenStream) -> TokenStream {
198198
#param::init_state(world, &mut #meta);
199199
let #param = #param::init_state(world, &mut system_meta.clone());
200200
)*
201-
// Make the ParamSet non-send if any of its parameters are non-send.
202-
if false #(|| !#meta.is_send())* {
203-
system_meta.set_non_send();
204-
}
205201
#(
206202
system_meta
207203
.component_access_set

crates/bevy_ecs/src/storage/resource_non_send.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,15 @@ impl ThreadLocalStorage {
424424
TLS.with_borrow_mut(|tls| tls.resource_scope(f))
425425
}
426426

427+
/// Runs `f` in a scope that has access to the thread-local resources.
428+
pub fn run<F, T>(&mut self, f: F) -> T
429+
where
430+
F: FnOnce(&mut ThreadLocals) -> T,
431+
T: 'static,
432+
{
433+
TLS.with_borrow_mut(|tls| f(tls))
434+
}
435+
427436
/// Inserts a channel into `world` that systems in `world` (via [`ThreadLocal`]) can use to
428437
/// access the underlying [`ThreadLocals`].
429438
pub fn insert_channel<S>(&self, world: &mut World, sender: S)

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,34 +1506,4 @@ mod tests {
15061506
schedule.add_systems(non_sync_system);
15071507
schedule.run(&mut world);
15081508
}
1509-
1510-
// Regression test for https://github.com/bevyengine/bevy/issues/10207.
1511-
#[test]
1512-
fn param_set_non_send_first() {
1513-
fn non_send_param_set(mut p: ParamSet<(NonSend<*mut u8>, ())>) {
1514-
let _ = p.p0();
1515-
p.p1();
1516-
}
1517-
1518-
let mut world = World::new();
1519-
world.insert_non_send_resource(std::ptr::null_mut::<u8>());
1520-
let mut schedule = crate::schedule::Schedule::default();
1521-
schedule.add_systems((non_send_param_set, non_send_param_set, non_send_param_set));
1522-
schedule.run(&mut world);
1523-
}
1524-
1525-
// Regression test for https://github.com/bevyengine/bevy/issues/10207.
1526-
#[test]
1527-
fn param_set_non_send_second() {
1528-
fn non_send_param_set(mut p: ParamSet<((), NonSendMut<*mut u8>)>) {
1529-
p.p0();
1530-
let _ = p.p1();
1531-
}
1532-
1533-
let mut world = World::new();
1534-
world.insert_non_send_resource(std::ptr::null_mut::<u8>());
1535-
let mut schedule = crate::schedule::Schedule::default();
1536-
schedule.add_systems((non_send_param_set, non_send_param_set, non_send_param_set));
1537-
schedule.run(&mut world);
1538-
}
15391509
}

0 commit comments

Comments
 (0)