Skip to content

Commit

Permalink
Fix an incorrect safety comment in World::get_resource (#6764)
Browse files Browse the repository at this point in the history
# Objective

* Fix #6307

## Solution

* Rewrite the safety comment to reflect the actual invariants being asserted.
  • Loading branch information
JoJoJet committed Nov 28, 2022
1 parent 70d7f80 commit 1615834
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ impl World {
#[inline]
pub fn get_resource<R: Resource>(&self) -> Option<&R> {
let component_id = self.components.get_resource_id(TypeId::of::<R>())?;
// SAFETY: unique world access
// SAFETY: `component_id` was obtained from the type ID of `R`.
unsafe { self.get_resource_with_id(component_id) }
}

Expand Down

0 comments on commit 1615834

Please sign in to comment.