Skip to content

Commit 0e41b79

Browse files
committed
debug_checked_unwrap should track its caller (#6452)
# Objective When an error causes `debug_checked_unreachable` to be called, the panic message unhelpfully points to the function definition instead of the place that caused the error. ## Solution Add the `#[track_caller]` attribute in debug mode.
1 parent 96c9c60 commit 0e41b79

File tree

1 file changed

+1
-0
lines changed
  • crates/bevy_ecs/src/query

1 file changed

+1
-0
lines changed

crates/bevy_ecs/src/query/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ impl<T> DebugCheckedUnwrap for Option<T> {
3232
type Item = T;
3333

3434
#[inline(always)]
35+
#[track_caller]
3536
unsafe fn debug_checked_unwrap(self) -> Self::Item {
3637
if let Some(inner) = self {
3738
inner

0 commit comments

Comments
 (0)