Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ const _: () = {

type Item<'w, 's> = Commands<'w, 's>;

#[track_caller]
fn init_state(world: &mut World) -> Self::State {
FetchState {
state: <__StructFieldsAlias<'_, '_> as bevy_ecs::system::SystemParam>::init_state(
Expand Down Expand Up @@ -193,6 +194,7 @@ const _: () = {
}

#[inline]
#[track_caller]
unsafe fn get_param<'w, 's>(
state: &'s mut Self::State,
system_meta: &bevy_ecs::system::SystemMeta,
Expand Down
4 changes: 4 additions & 0 deletions crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ all_tuples!(

impl<Param: SystemParam> SystemState<Param> {
/// Creates a new [`SystemState`] with default state.
#[track_caller]
pub fn new(world: &mut World) -> Self {
let mut meta = SystemMeta::new::<Param>();
meta.last_run = world.change_tick().relative_to(Tick::MAX);
Expand Down Expand Up @@ -362,6 +363,7 @@ impl<Param: SystemParam> SystemState<Param> {

/// Retrieve the mutable [`SystemParam`] values.
#[inline]
#[track_caller]
pub fn get_mut<'w, 's>(&'s mut self, world: &'w mut World) -> SystemParamItem<'w, 's, Param> {
self.validate_world(world.id());
// SAFETY: World is uniquely borrowed and matches the World this SystemState was created with.
Expand Down Expand Up @@ -421,6 +423,7 @@ impl<Param: SystemParam> SystemState<Param> {
/// access is safe in the context of global [`World`] access. The passed-in [`World`] _must_ be the [`World`] the [`SystemState`] was
/// created with.
#[inline]
#[track_caller]
pub unsafe fn get_unchecked<'w, 's>(
&'s mut self,
world: UnsafeWorldCell<'w>,
Expand All @@ -435,6 +438,7 @@ impl<Param: SystemParam> SystemState<Param> {
/// access is safe in the context of global [`World`] access. The passed-in [`World`] _must_ be the [`World`] the [`SystemState`] was
/// created with.
#[inline]
#[track_caller]
unsafe fn fetch<'w, 's>(
&'s mut self,
world: UnsafeWorldCell<'w>,
Expand Down
3 changes: 3 additions & 0 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,7 @@ unsafe impl<T: SystemBuffer> SystemParam for Deferred<'_, T> {
type State = SyncCell<T>;
type Item<'w, 's> = Deferred<'s, T>;

#[track_caller]
fn init_state(world: &mut World) -> Self::State {
SyncCell::new(T::from_world(world))
}
Expand Down Expand Up @@ -2171,6 +2172,7 @@ macro_rules! impl_system_param_tuple {
type Item<'w, 's> = ($($param::Item::<'w, 's>,)*);

#[inline]
#[track_caller]
fn init_state(world: &mut World) -> Self::State {
($($param::init_state(world),)*)
}
Expand Down Expand Up @@ -2216,6 +2218,7 @@ macro_rules! impl_system_param_tuple {
}

#[inline]
#[track_caller]
unsafe fn get_param<'w, 's>(
state: &'s mut Self::State,
system_meta: &SystemMeta,
Expand Down
1 change: 1 addition & 0 deletions crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3829,6 +3829,7 @@ pub trait FromWorld {

impl<T: Default> FromWorld for T {
/// Creates `Self` using [`default()`](`Default::default`).
#[track_caller]
fn from_world(_world: &mut World) -> Self {
T::default()
}
Expand Down