Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion release-content/0.16/migration-guides/_guides.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1017,4 +1017,10 @@ file_name = "18326_Use_4byte_LightmapSlabIndex_for_batching_instead_of_16byte.md
title = "Use `target_abi = \"sim\"` instead of `ios_simulator` feature"
prs = [17702]
areas = []
file_name = "17702_Use_target_abi__sim_instead_of_ios_simulator_feature.md"
file_name = "17702_Use_target_abi__sim_instead_of_ios_simulator_feature.md"

[[guides]]
title = "Closures which panic now need to explicitly specify a `()` return type"
prs = [17967]
areas = ["ECS"]
file_name = "panicking_closures.md"
11 changes: 11 additions & 0 deletions release-content/0.16/migration-guides/panicking_closures.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
As a result of changes to [Never type fallback] in Rust 2024, closures which panic now have an inferred return type of `!`, rather than `()`. This might occur if you're using `panic!`, `todo!`, `unimplemented!`, `unreachable!` or other means of panicking.

This affects Bevy users as our blanket implementations for `Command`, `IntoSystem` and `IntoObserverSystem` which operate on all matching functions with the correct type signature no longer cover closures of this sort.

While this may be fixable on Bevy's end (see [#18778]), for now, you can work around this issue by either:

1. Converting your closures to ordinary named functions, whose return type is not inferred.
2. Explicitly specifying the return type of your closure as `()`.

[Never type fallback]: https://doc.rust-lang.org/edition-guide/rust-2024/never-type-fallback.html
[#18778]: https://github.com/bevyengine/bevy/issues/18778