Skip to content

Commit 143f4ec

Browse files
remove unneccessary safety requirement
1 parent 09073a9 commit 143f4ec

File tree

1 file changed

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

1 file changed

+5
-1
lines changed

crates/bevy_ecs/src/storage/mod.rs

Lines changed: 5 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
/// - `storage_type` must accurately reflect where the components for `component_id` are stored.
3534
/// - `Archetypes` and `Components` must come from the world this of this `Storages`
3635
/// - the caller must ensure that no aliasing rules are violated
@@ -45,6 +44,7 @@ impl Storages {
4544
location: EntityLocation,
4645
) -> Option<(Ptr<'_>, TickCells<'_>)> {
4746
let component_id = components.get_id(type_id)?;
47+
// SAFETY: component_id is valid, the rest is deferred to caller
4848
self.get_component_and_ticks(archetypes, component_id, storage_type, entity, location)
4949
}
5050

@@ -88,6 +88,7 @@ impl Storages {
8888
/// # Safety
8989
/// - `entity_location` must be within bounds of the given archetype and `entity` must exist inside
9090
/// the archetype
91+
/// - `storage_type` must accurately reflect where the components for `component_id` are stored.
9192
/// - `Archetypes` and `Components` must come from the world this of this `Storages`
9293
/// - the caller must ensure that no aliasing rules are violated
9394
#[inline]
@@ -101,6 +102,7 @@ impl Storages {
101102
location: EntityLocation,
102103
) -> Option<Ptr<'_>> {
103104
let component_id = components.get_id(type_id)?;
105+
// SAFETY: component_id is valid, the rest is deferred to caller
104106
self.get_component(archetypes, component_id, storage_type, entity, location)
105107
}
106108

@@ -139,6 +141,7 @@ impl Storages {
139141
/// # Safety
140142
/// - `entity_location` must be within bounds of the given archetype and `entity` must exist inside
141143
/// the archetype
144+
/// - `storage_type` must accurately reflect where the components for `component_id` are stored.
142145
/// - `Archetypes` and `Components` must come from the world this of this `Storages`
143146
/// - the caller must ensure that no aliasing rules are violated
144147
#[inline]
@@ -152,6 +155,7 @@ impl Storages {
152155
location: EntityLocation,
153156
) -> Option<ComponentTicks> {
154157
let component_id = components.get_id(type_id)?;
158+
// SAFETY: component_id is valid, the rest is deferred to caller
155159
self.get_ticks(archetypes, component_id, storage_type, entity, location)
156160
}
157161

0 commit comments

Comments
 (0)