Skip to content

Commit 39751f2

Browse files
authored
Depend on bevy_tasks::block_on instead of futures_lite::block_on (#20495)
# Objective `bevy_tasks::block_on` is aliased depending on the features enabled on the crate. If a Bevy-specific version of a `block_on` is implemented, it should be using it as well. The rest of the engine should use the version bevy_tasks exposes. ## Solution Remove the direct dependencies on `futures_lite::block_on` and use `bevy_tasks::block_on` instead. ## Testing CI should pass.
1 parent 3562b13 commit 39751f2

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

crates/bevy_render/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ bytemuck = { version = "1.5", features = ["derive", "must_cast"] }
104104
downcast-rs = { version = "2", default-features = false, features = ["std"] }
105105
thiserror = { version = "2", default-features = false }
106106
derive_more = { version = "2", default-features = false, features = ["from"] }
107-
futures-lite = "2.0.1"
108107
encase = { version = "0.11", features = ["glam"] }
109108
# For wgpu profiling using tracing. Use `RUST_LOG=info` to also capture the wgpu spans.
110109
profiling = { version = "1", features = [

crates/bevy_render/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl Plugin for RenderPlugin {
409409
.detach();
410410
// Otherwise, just block for it to complete
411411
#[cfg(not(target_arch = "wasm32"))]
412-
futures_lite::future::block_on(async_renderer);
412+
bevy_tasks::block_on(async_renderer);
413413

414414
// SAFETY: Plugins should be set up on the main thread.
415415
unsafe { initialize_render_app(app) };

crates/bevy_render/src/render_resource/pipeline_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ fn create_pipeline_task(
810810
return CachedPipelineState::Creating(bevy_tasks::AsyncComputeTaskPool::get().spawn(task));
811811
}
812812

813-
match futures_lite::future::block_on(task) {
813+
match bevy_tasks::block_on(task) {
814814
Ok(pipeline) => CachedPipelineState::Ok(pipeline),
815815
Err(err) => CachedPipelineState::Err(err),
816816
}
@@ -825,7 +825,7 @@ fn create_pipeline_task(
825825
task: impl Future<Output = Result<Pipeline, PipelineCacheError>> + Send + 'static,
826826
_sync: bool,
827827
) -> CachedPipelineState {
828-
match futures_lite::future::block_on(task) {
828+
match bevy_tasks::block_on(task) {
829829
Ok(pipeline) => CachedPipelineState::Ok(pipeline),
830830
Err(err) => CachedPipelineState::Err(err),
831831
}

crates/bevy_tasks/src/edge_executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ impl<const C: usize> State<C> {
481481
mod different_executor_tests {
482482
use core::cell::Cell;
483483

484-
use futures_lite::future::{block_on, pending, poll_once};
484+
use bevy_tasks::{block_on, futures_lite::{pending, poll_once}};
485485
use futures_lite::pin;
486486

487487
use super::LocalExecutor;

0 commit comments

Comments
 (0)