Skip to content

Commit e04a73e

Browse files
corehjames-j-obrien
andcommitted
Add safety comments
Co-authored-by: James O'Brien <[email protected]>
1 parent 9319c56 commit e04a73e

File tree

1 file changed

+4
-2
lines changed
  • crates/bevy_ecs/src/world

1 file changed

+4
-2
lines changed

crates/bevy_ecs/src/world/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,14 +2355,16 @@ impl World {
23552355
});
23562356

23572357
// SAFETY:
2358-
// - ???
2358+
// - We have exclusive access to the world, so no other code can be aliasing the `TickCells`
2359+
// - We only hold one `TicksMut` at a time, and we let go of it before getting the next one
23592360
let ticks = unsafe {
23602361
TicksMut::from_tick_cells(ticks, self.last_change_tick(), self.read_change_tick())
23612362
};
23622363

23632364
let mut_untyped = MutUntyped {
23642365
// SAFETY:
2365-
// - ???
2366+
// - We have exclusive access to the world, so no other code can be aliasing the `Ptr`
2367+
// - We iterate one resource at a time, and we let go of each `PtrMut` before getting the next one
23662368
value: unsafe { ptr.assert_unique() },
23672369
ticks,
23682370
};

0 commit comments

Comments
 (0)