Skip to content

Fix cfg_select! compile error in panic handler#24030

Merged
alice-i-cecile merged 1 commit intobevyengine:mainfrom
greeble-dev:panic-handler-cfg-select
Apr 29, 2026
Merged

Fix cfg_select! compile error in panic handler#24030
alice-i-cecile merged 1 commit intobevyengine:mainfrom
greeble-dev:panic-handler-cfg-select

Conversation

@greeble-dev
Copy link
Copy Markdown
Contributor

@greeble-dev greeble-dev commented Apr 29, 2026

Objective

Ran into this after #23896:

> cargo build -p bevy_app --no-default-features --features "std"

error: none of the predicates in this `cfg_select` evaluated to true
  --> crates\bevy_app\src\panic_handler.rs:46:17
   |
46 | /                 cfg_select! {
47 | |                     all(target_arch = "wasm32", feature = "web") => {
48 | |                         // This provides better panic handling in JS engines (displays the panic message and improves the backtrace).
49 | |                         std::panic::set_hook(alloc::boxed::Box::new(console_error_panic_hook::hook));
...  |
58 | |                 }
   | |_________________^

Solution

Add a fallback clause. Also did a quick scan to confirm that other cases of cfg_select! were fine.

Testing

cargo build -p bevy_app --no-default-features --features "std"
cargo build -p bevy_app --no-default-features
cargo build -p bevy_app
cargo run --example 3d_scene
cargo run --example 3d_scene --target wasm32-unknown-unknown --features "webgpu"

@greeble-dev greeble-dev added C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy A-App Bevy apps and plugins P-Compile-Failure A failure to compile Bevy apps S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Apr 29, 2026
@greeble-dev greeble-dev changed the title Fix cfg_select! compiler error in panic handler Fix cfg_select! compile error in panic handler Apr 29, 2026
@alice-i-cecile alice-i-cecile removed the S-Needs-Review Needs reviewer attention (from anyone!) to move forward label Apr 29, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 29, 2026
@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Apr 29, 2026
@alice-i-cecile alice-i-cecile modified the milestones: 0.20, 0.19 Apr 29, 2026
Merged via the queue into bevyengine:main with commit 8805968 Apr 29, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-App Bevy apps and plugins C-Bug An unexpected or incorrect behavior D-Trivial Nice and easy! A great choice to get started with Bevy P-Compile-Failure A failure to compile Bevy apps S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants