Skip to content

Commit 0eff0a0

Browse files
remove unneccessary safety requirement
1 parent 99aab8d commit 0eff0a0

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
@@ -31,7 +31,6 @@ impl Storages {
3131
///
3232
/// # Safety
3333
/// - `entity_location` must be within bounds of the given archetype and `entity` must exist inside
34-
/// - `component_id` must be valid
3534
/// - `storage_type` must accurately reflect where the components for `component_id` are stored.
3635
/// - `Archetypes` and `Components` must come from the world this of this `Storages`
3736
/// - the caller must ensure that no aliasing rules are violated
@@ -46,6 +45,7 @@ impl Storages {
4645
location: EntityLocation,
4746
) -> Option<(Ptr<'_>, TickCells<'_>)> {
4847
let component_id = components.get_id(type_id)?;
48+
// SAFETY: component_id is valid, the rest is deferred to caller
4949
self.get_component_and_ticks(archetypes, component_id, storage_type, entity, location)
5050
}
5151

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

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

0 commit comments

Comments
 (0)