Skip to content

Commit 617f6f4

Browse files
committed
ci fix
1 parent c27257f commit 617f6f4

File tree

4 files changed

+11
-40
lines changed

4 files changed

+11
-40
lines changed

crates/bevy_ecs/src/entity/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,10 @@ pub type EntityIdLocation = Option<EntityLocation>;
13211321
/// An [`Entity`] that has been disabled. This entity will not be found by queries or accessible via other ECS operations, but it's components are still stored in the ECS.
13221322
/// This is useful for temporarily disabling an entity without fully despawning it or invoking archetype moves. This entity keeps track of its location, so it can be re-enabled later.
13231323
pub struct DisabledEntity {
1324+
/// The disabled entity.
13241325
pub entity: Entity,
1326+
/// The location of the entity after it was disabled.
1327+
/// This may not necessarily be it's location when it is re-enabled.
13251328
pub location: EntityLocation,
13261329
}
13271330

crates/bevy_ecs/src/storage/blob_array.rs

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use core::{
77
alloc::Layout,
88
cell::UnsafeCell,
99
num::NonZeroUsize,
10-
ops::{Bound, Range, RangeBounds},
10+
ops::{Bound, RangeBounds},
1111
ptr::NonNull,
1212
};
1313

@@ -155,38 +155,6 @@ impl BlobArray {
155155
}
156156
}
157157

158-
/// Clears the array, i.e. removing (and dropping) all of the elements.
159-
/// Note that this method has no effect on the allocated capacity of the vector.
160-
///
161-
/// Note that this method will behave exactly the same as [`Vec::clear`].
162-
///
163-
/// # Safety
164-
/// - For every element with index `i`, if `i` < `len`: It must be safe to call [`Self::get_unchecked_mut`] with `i`.
165-
/// (If the safety requirements of every method that has been used on `Self` have been fulfilled, the caller just needs to ensure that `len` is correct.)
166-
///
167-
/// [`Vec::clear`]: alloc::vec::Vec::clear
168-
pub unsafe fn clear(&mut self, len: usize) {
169-
#[cfg(debug_assertions)]
170-
debug_assert!(self.capacity >= len);
171-
if let Some(drop) = self.drop {
172-
// We set `self.drop` to `None` before dropping elements for unwind safety. This ensures we don't
173-
// accidentally drop elements twice in the event of a drop impl panicking.
174-
self.drop = None;
175-
let size = self.item_layout.size();
176-
for i in 0..len {
177-
// SAFETY:
178-
// * 0 <= `i` < `len`, so `i * size` must be in bounds for the allocation.
179-
// * `size` is a multiple of the erased type's alignment,
180-
// so adding a multiple of `size` will preserve alignment.
181-
// * The item is left unreachable so it can be safely promoted to an `OwningPtr`.
182-
let item = unsafe { self.get_ptr_mut().byte_add(i * size).promote() };
183-
// SAFETY: `item` was obtained from this `BlobArray`, so its underlying type must match `drop`.
184-
unsafe { drop(item) };
185-
}
186-
self.drop = Some(drop);
187-
}
188-
}
189-
190158
/// Clears the array, i.e. removing (and dropping) all of the elements in the range.
191159
/// Note that this method has no effect on the allocated capacity of the vector.
192160
///
@@ -236,11 +204,11 @@ impl BlobArray {
236204
/// # Safety
237205
/// - `cap` and `len` are indeed the capacity and length of this [`BlobArray`]
238206
/// - This [`BlobArray`] mustn't be used after calling this method.
239-
pub unsafe fn drop(&mut self, cap: usize, len: usize) {
207+
pub unsafe fn drop(&mut self, cap: usize, range: impl RangeBounds<usize>) {
240208
#[cfg(debug_assertions)]
241209
debug_assert_eq!(self.capacity, cap);
242210
if cap != 0 {
243-
self.clear(len);
211+
self.clear_range(range);
244212
if !self.is_zst() {
245213
let layout =
246214
array_layout(&self.item_layout, cap).expect("array layout should be valid");

crates/bevy_ecs/src/storage/table/column.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
};
77
use alloc::vec::Vec;
88
use bevy_ptr::PtrMut;
9-
use core::panic::Location;
9+
use core::{ops::RangeBounds, panic::Location};
1010

1111
/// Very similar to a normal [`Column`], but with the capacities and lengths cut out for performance reasons.
1212
///
@@ -270,7 +270,7 @@ impl ThinColumn {
270270
pub(crate) unsafe fn clear(&mut self, len: usize) {
271271
self.added_ticks.clear_elements(len);
272272
self.changed_ticks.clear_elements(len);
273-
self.data.clear(len);
273+
self.data.clear_range(..len);
274274
self.changed_by
275275
.as_mut()
276276
.map(|changed_by| changed_by.clear_elements(len));
@@ -283,10 +283,10 @@ impl ThinColumn {
283283
/// - `len` is indeed the length of the column
284284
/// - `cap` is indeed the capacity of the column
285285
/// - the data stored in `self` will never be used again
286-
pub(crate) unsafe fn drop(&mut self, cap: usize, len: usize) {
286+
pub(crate) unsafe fn drop(&mut self, cap: usize, len: usize, range: impl RangeBounds<usize>) {
287287
self.added_ticks.drop(cap, len);
288288
self.changed_ticks.drop(cap, len);
289-
self.data.drop(cap, len);
289+
self.data.drop(cap, range);
290290
self.changed_by
291291
.as_mut()
292292
.map(|changed_by| changed_by.drop(cap, len));

crates/bevy_ecs/src/storage/table/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ impl Drop for Table {
916916
// SAFETY: `cap` and `len` are correct
917917
unsafe {
918918
// TODO: don't drop disabled entities components
919-
col.drop(cap, len);
919+
col.drop(cap, len, self.disabled_entities as usize..len);
920920
}
921921
}
922922
}

0 commit comments

Comments
 (0)