Skip to content

Commit b131081

Browse files
committed
change safety comment to expect to emphasize possible UB
1 parent 9569011 commit b131081

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

crates/bevy_ecs/src/schedule/executor/multi_threaded.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,13 @@ impl ExecutorState {
448448
}
449449

450450
#[cfg(feature = "hotpatching")]
451-
// SAFETY: This operation is not safe. It could create UB if a user creates a mutable reference
452-
// to `HotPatchChanges` in a system. But this can only happen when the `hotpatching` feature is
453-
// enabled.
451+
#[expect(
452+
clippy::undocumented_unsafe_blocks,
453+
reason = "This actually could result in UB if a system tries to mutate
454+
`HotPatchChanges`. We allow this as the resource only exists with the `hotpatching` feature.
455+
and `hotpatching` should never be enabled in release."
456+
)]
457+
#[cfg(feature = "hotpatching")]
454458
let hotpatch_tick = unsafe {
455459
context
456460
.environment

0 commit comments

Comments
 (0)