Skip to content

Commit bee0d92

Browse files
remove unneccessary safety requirement
1 parent c68bf83 commit bee0d92

File tree

1 file changed

+3
-1
lines changed
  • crates/bevy_ecs/src/storage

1 file changed

+3
-1
lines changed

crates/bevy_ecs/src/storage/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ impl Storages {
3030
///
3131
/// # Safety
3232
/// - `entity_location` must be within bounds of the given archetype and `entity` must exist inside
33-
/// - `component_id` must be valid
3433
/// - `Archetypes` and `Components` must come from the world this of this `Storages`
3534
/// - the caller must ensure that no aliasing rules are violated
3635
#[inline]
@@ -43,6 +42,7 @@ impl Storages {
4342
location: EntityLocation,
4443
) -> Option<(Ptr<'_>, &UnsafeCell<ComponentTicks>)> {
4544
let component_id = components.get_id(type_id)?;
45+
// SAFETY: component_id is valid, the rest is deferred to caller
4646
self.get_component_and_ticks(archetypes, components, component_id, entity, location)
4747
}
4848

@@ -102,6 +102,7 @@ impl Storages {
102102
location: EntityLocation,
103103
) -> Option<Ptr<'_>> {
104104
let component_id = components.get_id(type_id)?;
105+
// SAFETY: component_id is valid, the rest is deferred to caller
105106
self.get_component(archetypes, components, component_id, entity, location)
106107
}
107108

@@ -157,6 +158,7 @@ impl Storages {
157158
location: EntityLocation,
158159
) -> Option<&UnsafeCell<ComponentTicks>> {
159160
let component_id = components.get_id(type_id)?;
161+
// SAFETY: component_id is valid, the rest is deferred to caller
160162
self.get_ticks(archetypes, components, component_id, entity, location)
161163
}
162164

0 commit comments

Comments
 (0)