Skip to content

Commit 63e78fe

Browse files
Deprecated Begone! 0.16 Cleanup (#19108)
# Objective A fair few items were deprecated in 0.16. Let's delete them now that we're in the 0.17 development cycle! ## Solution - Deleted items marked deprecated in 0.16. ## Testing - CI --- ## Notes I'm making the assumption that _everything_ deprecated in 0.16 should be removed in 0.17. That may be a false assumption in certain cases. Please check the items to be removed to see if there are any exceptions we should keep around for another cycle!
1 parent 4051465 commit 63e78fe

File tree

27 files changed

+9
-410
lines changed

27 files changed

+9
-410
lines changed

crates/bevy_asset/src/handle.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use core::{
1111
use crossbeam_channel::{Receiver, Sender};
1212
use disqualified::ShortName;
1313
use thiserror::Error;
14-
use uuid::Uuid;
1514

1615
/// Provides [`Handle`] and [`UntypedHandle`] _for a specific asset type_.
1716
/// This should _only_ be used for one specific asset type.
@@ -149,17 +148,6 @@ impl<T: Asset> Clone for Handle<T> {
149148
}
150149

151150
impl<A: Asset> Handle<A> {
152-
/// Create a new [`Handle::Weak`] with the given [`u128`] encoding of a [`Uuid`].
153-
#[deprecated(
154-
since = "0.16.0",
155-
note = "use the `weak_handle!` macro with a UUID string instead"
156-
)]
157-
pub const fn weak_from_u128(value: u128) -> Self {
158-
Handle::Weak(AssetId::Uuid {
159-
uuid: Uuid::from_u128(value),
160-
})
161-
}
162-
163151
/// Returns the [`AssetId`] of this [`Asset`].
164152
#[inline]
165153
pub fn id(&self) -> AssetId<A> {
@@ -554,6 +542,7 @@ mod tests {
554542
use bevy_platform::hash::FixedHasher;
555543
use bevy_reflect::PartialReflect;
556544
use core::hash::BuildHasher;
545+
use uuid::Uuid;
557546

558547
use super::*;
559548

crates/bevy_ecs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ struct MyEvent {
290290
}
291291

292292
fn writer(mut writer: EventWriter<MyEvent>) {
293-
writer.send(MyEvent {
293+
writer.write(MyEvent {
294294
message: "hello!".to_string(),
295295
});
296296
}

crates/bevy_ecs/src/component.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -509,15 +509,6 @@ pub trait Component: Send + Sync + 'static {
509509
/// * For a component to be immutable, this type must be [`Immutable`].
510510
type Mutability: ComponentMutability;
511511

512-
/// Called when registering this component, allowing mutable access to its [`ComponentHooks`].
513-
#[deprecated(
514-
since = "0.16.0",
515-
note = "Use the individual hook methods instead (e.g., `Component::on_add`, etc.)"
516-
)]
517-
fn register_component_hooks(hooks: &mut ComponentHooks) {
518-
hooks.update_from_component::<Self>();
519-
}
520-
521512
/// Gets the `on_add` [`ComponentHook`] for this [`Component`] if one is defined.
522513
fn on_add() -> Option<ComponentHook> {
523514
None
@@ -694,7 +685,7 @@ pub struct HookContext {
694685
/// This information is stored in the [`ComponentInfo`] of the associated component.
695686
///
696687
/// There is two ways of configuring hooks for a component:
697-
/// 1. Defining the [`Component::register_component_hooks`] method (see [`Component`])
688+
/// 1. Defining the relevant hooks on the [`Component`] implementation
698689
/// 2. Using the [`World::register_component_hooks`] method
699690
///
700691
/// # Example 2
@@ -1810,12 +1801,7 @@ impl<'w> ComponentsRegistrator<'w> {
18101801
.debug_checked_unwrap()
18111802
};
18121803

1813-
#[expect(
1814-
deprecated,
1815-
reason = "need to use this method until it is removed to ensure user defined components register hooks correctly"
1816-
)]
1817-
// TODO: Replace with `info.hooks.update_from_component::<T>();` once `Component::register_component_hooks` is removed
1818-
T::register_component_hooks(&mut info.hooks);
1804+
info.hooks.update_from_component::<T>();
18191805

18201806
info.required_components = required_components;
18211807
}

crates/bevy_ecs/src/event/writer.rs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -98,38 +98,4 @@ impl<'w, E: Event> EventWriter<'w, E> {
9898
{
9999
self.events.send_default()
100100
}
101-
102-
/// Sends an `event`, which can later be read by [`EventReader`](super::EventReader)s.
103-
/// This method returns the [ID](`EventId`) of the sent `event`.
104-
///
105-
/// See [`Events`] for details.
106-
#[deprecated(since = "0.16.0", note = "Use `EventWriter::write` instead.")]
107-
#[track_caller]
108-
pub fn send(&mut self, event: E) -> EventId<E> {
109-
self.write(event)
110-
}
111-
112-
/// Sends a list of `events` all at once, which can later be read by [`EventReader`](super::EventReader)s.
113-
/// This is more efficient than sending each event individually.
114-
/// This method returns the [IDs](`EventId`) of the sent `events`.
115-
///
116-
/// See [`Events`] for details.
117-
#[deprecated(since = "0.16.0", note = "Use `EventWriter::write_batch` instead.")]
118-
#[track_caller]
119-
pub fn send_batch(&mut self, events: impl IntoIterator<Item = E>) -> SendBatchIds<E> {
120-
self.write_batch(events)
121-
}
122-
123-
/// Sends the default value of the event. Useful when the event is an empty struct.
124-
/// This method returns the [ID](`EventId`) of the sent `event`.
125-
///
126-
/// See [`Events`] for details.
127-
#[deprecated(since = "0.16.0", note = "Use `EventWriter::write_default` instead.")]
128-
#[track_caller]
129-
pub fn send_default(&mut self) -> EventId<E>
130-
where
131-
E: Default,
132-
{
133-
self.write_default()
134-
}
135101
}

crates/bevy_ecs/src/hierarchy.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,6 @@ impl ChildOf {
106106
pub fn parent(&self) -> Entity {
107107
self.0
108108
}
109-
110-
/// The parent entity of this child entity.
111-
#[deprecated(since = "0.16.0", note = "Use child_of.parent() instead")]
112-
#[inline]
113-
pub fn get(&self) -> Entity {
114-
self.0
115-
}
116109
}
117110

118111
// TODO: We need to impl either FromWorld or Default so ChildOf can be registered as Reflect.
@@ -344,20 +337,6 @@ impl<'w> EntityWorldMut<'w> {
344337
});
345338
self
346339
}
347-
348-
/// Removes the [`ChildOf`] component, if it exists.
349-
#[deprecated(since = "0.16.0", note = "Use entity_mut.remove::<ChildOf>()")]
350-
pub fn remove_parent(&mut self) -> &mut Self {
351-
self.remove::<ChildOf>();
352-
self
353-
}
354-
355-
/// Inserts the [`ChildOf`] component with the given `parent` entity, if it exists.
356-
#[deprecated(since = "0.16.0", note = "Use entity_mut.insert(ChildOf(entity))")]
357-
pub fn set_parent(&mut self, parent: Entity) -> &mut Self {
358-
self.insert(ChildOf(parent));
359-
self
360-
}
361340
}
362341

363342
impl<'a> EntityCommands<'a> {
@@ -434,20 +413,6 @@ impl<'a> EntityCommands<'a> {
434413
self.with_related::<ChildOf>(bundle);
435414
self
436415
}
437-
438-
/// Removes the [`ChildOf`] component, if it exists.
439-
#[deprecated(since = "0.16.0", note = "Use entity_commands.remove::<ChildOf>()")]
440-
pub fn remove_parent(&mut self) -> &mut Self {
441-
self.remove::<ChildOf>();
442-
self
443-
}
444-
445-
/// Inserts the [`ChildOf`] component with the given `parent` entity, if it exists.
446-
#[deprecated(since = "0.16.0", note = "Use entity_commands.insert(ChildOf(entity))")]
447-
pub fn set_parent(&mut self, parent: Entity) -> &mut Self {
448-
self.insert(ChildOf(parent));
449-
self
450-
}
451416
}
452417

453418
/// An `on_insert` component hook that when run, will validate that the parent of a given entity

crates/bevy_ecs/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ pub use bevy_ptr as ptr;
6464
///
6565
/// This includes the most common types in this crate, re-exported for your convenience.
6666
pub mod prelude {
67-
#[expect(
68-
deprecated,
69-
reason = "`crate::schedule::apply_deferred` is considered deprecated; however, it may still be used by crates which consume `bevy_ecs`, so its removal here may cause confusion. It is intended to be removed in the Bevy 0.17 cycle."
70-
)]
7167
#[doc(hidden)]
7268
pub use crate::{
7369
bundle::Bundle,
@@ -86,8 +82,8 @@ pub mod prelude {
8682
removal_detection::RemovedComponents,
8783
resource::Resource,
8884
schedule::{
89-
apply_deferred, common_conditions::*, ApplyDeferred, Condition, IntoScheduleConfigs,
90-
IntoSystemSet, Schedule, Schedules, SystemSet,
85+
common_conditions::*, ApplyDeferred, Condition, IntoScheduleConfigs, IntoSystemSet,
86+
Schedule, Schedules, SystemSet,
9187
},
9288
spawn::{Spawn, SpawnRelated},
9389
system::{

crates/bevy_ecs/src/query/state.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,16 +1800,6 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
18001800
self.query(world).single_inner()
18011801
}
18021802

1803-
/// A deprecated alias for [`QueryState::single`].
1804-
#[deprecated(since = "0.16.0", note = "Please use `single` instead.")]
1805-
#[inline]
1806-
pub fn get_single<'w>(
1807-
&mut self,
1808-
world: &'w World,
1809-
) -> Result<ROQueryItem<'w, D>, QuerySingleError> {
1810-
self.single(world)
1811-
}
1812-
18131803
/// Returns a single mutable query result when there is exactly one entity matching
18141804
/// the query.
18151805
///
@@ -1827,15 +1817,6 @@ impl<D: QueryData, F: QueryFilter> QueryState<D, F> {
18271817
self.query_mut(world).single_inner()
18281818
}
18291819

1830-
/// A deprecated alias for [`QueryState::single_mut`].
1831-
#[deprecated(since = "0.16.0", note = "Please use `single` instead.")]
1832-
pub fn get_single_mut<'w>(
1833-
&mut self,
1834-
world: &'w mut World,
1835-
) -> Result<D::Item<'w>, QuerySingleError> {
1836-
self.single_mut(world)
1837-
}
1838-
18391820
/// Returns a query result when there is exactly one entity matching the query.
18401821
///
18411822
/// If the number of query results is not exactly one, a [`QuerySingleError`] is returned

crates/bevy_ecs/src/schedule/executor/mod.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,6 @@ impl SystemSchedule {
123123
}
124124
}
125125

126-
/// See [`ApplyDeferred`].
127-
#[deprecated(
128-
since = "0.16.0",
129-
note = "Use `ApplyDeferred` instead. This was previously a function but is now a marker struct System."
130-
)]
131-
#[expect(
132-
non_upper_case_globals,
133-
reason = "This item is deprecated; as such, its previous name needs to stay."
134-
)]
135-
pub const apply_deferred: ApplyDeferred = ApplyDeferred;
136-
137126
/// A special [`System`] that instructs the executor to call
138127
/// [`System::apply_deferred`] on the systems that have run but not applied
139128
/// their [`Deferred`] system parameters (like [`Commands`]) or other system buffers.

crates/bevy_ecs/src/system/commands/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,14 +1749,6 @@ impl<'a> EntityCommands<'a> {
17491749
pub fn despawn(&mut self) {
17501750
self.queue_handled(entity_command::despawn(), warn);
17511751
}
1752-
/// Despawns the provided entity and its descendants.
1753-
#[deprecated(
1754-
since = "0.16.0",
1755-
note = "Use entity.despawn(), which now automatically despawns recursively."
1756-
)]
1757-
pub fn despawn_recursive(&mut self) {
1758-
self.despawn();
1759-
}
17601752

17611753
/// Despawns the entity.
17621754
///

0 commit comments

Comments
 (0)