Skip to content

Commit 40bd782

Browse files
fix safety comment
1 parent 0c483cf commit 40bd782

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/bevy_ecs/src/world/entity_ref.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ pub(crate) unsafe fn get_mut_by_id(
887887
/// Caller is responsible to drop component data behind returned pointer.
888888
///
889889
/// # Safety
890-
/// - `location` must be within bounds of the given archetype and `entity` must exist inside the `archetype`
890+
/// - `location.table_row` must be in bounds of column of component id `component_id`
891891
/// - `component_id` must be valid
892892
/// - `components` must come from the same world as `self`
893893
/// - The relevant table row **must be removed** by the caller once all components are taken, without dropping the value
@@ -900,13 +900,13 @@ pub(crate) unsafe fn take_component<'a>(
900900
entity: Entity,
901901
location: EntityLocation,
902902
) -> OwningPtr<'a> {
903+
// SAFETY: caller promises component_id to be valid
903904
let component_info = components.get_info_unchecked(component_id);
904905
let removed_components = removed_components.get_or_insert_with(component_id, Vec::new);
905906
removed_components.push(entity);
906907
match component_info.storage_type() {
907908
StorageType::Table => {
908909
let table = &mut storages.tables[location.table_id];
909-
// SAFETY: archetypes will always point to valid columns
910910
let components = table.get_column_mut(component_id).unwrap();
911911
// SAFETY:
912912
// - archetypes only store valid table_rows

0 commit comments

Comments
 (0)