Skip to content

Commit 8919ad1

Browse files
Removed invalid ECS archetype constants (#21741)
# Objective This is a tiny clean up to #19451 that removes some now completely unneeded public constants. I mean, they aren't wrong, but there's no point to their existence. ## Solution Removed `ArchetypeRow::INVALID` and `ArchetypeId::INVALID` and extend migration guide.
1 parent a4cfc24 commit 8919ad1

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

crates/bevy_ecs/src/archetype.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ pub(crate) struct ArchetypeCreated(pub ArchetypeId);
5454
pub struct ArchetypeRow(NonMaxU32);
5555

5656
impl ArchetypeRow {
57-
/// Index indicating an invalid archetype row.
58-
/// This is meant to be used as a placeholder.
59-
// TODO: Deprecate in favor of options, since `INVALID` is, technically, valid.
60-
pub const INVALID: ArchetypeRow = ArchetypeRow(NonMaxU32::MAX);
61-
6257
/// Creates a `ArchetypeRow`.
6358
#[inline]
6459
pub const fn new(index: NonMaxU32) -> Self {
@@ -95,10 +90,6 @@ pub struct ArchetypeId(u32);
9590
impl ArchetypeId {
9691
/// The ID for the [`Archetype`] without any components.
9792
pub const EMPTY: ArchetypeId = ArchetypeId(0);
98-
/// # Safety:
99-
///
100-
/// This must always have an all-1s bit pattern to ensure soundness in fast entity id space allocation.
101-
pub const INVALID: ArchetypeId = ArchetypeId(u32::MAX);
10293

10394
/// Create an `ArchetypeId` from a plain value.
10495
///

release-content/migration-guides/entities_apis.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ If you only want spawned entities, use `Commands::get_spawned_entity`.
6262

6363
### Other entity interactions
6464

65+
The `ArchetypeRow::INVALID` and `ArchetypeId::INVALID` constants have been removed, since they are no longer needed for flushing.
66+
If you depended on these, use options instead.
67+
6568
`BundleSpawner::spawn_non_existent` is now `BundleSpawner::construct`.
6669
`World::inspect_entity` now errors with `EntityNotSpawnedError` instead of `EntityDoesNotExistError`.
6770
`QueryEntityError::EntityDoesNotExist` is now `QueryEntityError::NotSpawned`.

0 commit comments

Comments
 (0)