Skip to content

resource_scope: Propagate source location tracking#24221

Open
SpecificProtagonist wants to merge 1 commit intobevyengine:mainfrom
SpecificProtagonist:push-zvmmsxqzkvzp
Open

resource_scope: Propagate source location tracking#24221
SpecificProtagonist wants to merge 1 commit intobevyengine:mainfrom
SpecificProtagonist:push-zvmmsxqzkvzp

Conversation

@SpecificProtagonist
Copy link
Copy Markdown
Contributor

@SpecificProtagonist SpecificProtagonist commented May 9, 2026

Objective

Part of #16775

If a resource is mutated in resource_scope, store the tracked source location.

Showcase

This used to print the location of the insert_resource call; it now prints the location of the deref_mut call:

#[derive(Resource)]
struct A;
let mut world = World::new();
world.insert_resource(A);
world.resource_scope::<A, _>(|_, mut a| {
    a.deref_mut();
});
dbg!(world.resource_ref::<A>().changed_by());

@SpecificProtagonist SpecificProtagonist added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events X-Uncontroversial This work is generally agreed upon S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels May 9, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in ECS May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Bug An unexpected or incorrect behavior S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Uncontroversial This work is generally agreed upon

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

1 participant