resource_scope: Propagate source location tracking (#24221)
# 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:
```rust
#[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());
``` M
Mira committed
20ddfc46d2dd2ce5b1835a2ccb3d4b9f8a5552ca
Parent: 85a87c4
Committed by GitHub <noreply@github.com>
on 5/21/2026, 1:17:54 PM