Skip to content

Commit

Permalink
Add safety comments
Browse files Browse the repository at this point in the history
Co-authored-by: James O'Brien <james.obrien@drafly.net>
  • Loading branch information
coreh and james-j-obrien committed Feb 21, 2024
1 parent 9319c56 commit e04a73e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2355,14 +2355,16 @@ impl World {
});

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

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

0 comments on commit e04a73e

Please sign in to comment.