While experimenting with the recent additions from #876, the following issue appeared while using a Local<T> in either system of a ChainSystem. It appears that the Locals are never added when the systems are initialized.
Bevy version
https://github.com/bevyengine/bevy/commit/d6eb64745176c42cd225492405df25b0e42793b3
What you did
use bevy::prelude::*;
fn system() {}
fn system_with_local(_: Local<u8>) {}
fn handler(In(()): In<()>) {}
fn handler_with_local(In(()): In<()>, _: Local<u8>) {}
fn main() {
App::build()
// the follow are ok
.add_system(system)
.add_system(system.chain(handler))
.add_system(system_with_local)
// the following panic with the message: "panicked at 'Resource does not exist u8'"
.add_system(system_with_local.chain(handler))
.add_system(system.chain(handler_with_local))
.add_system(system_with_local.chain(handler_with_local))
.run();
}
cargo run
What you expected to happen
The app to run silently then promptly exit.
What actually happened
When the systems run, the app panics with the message panicked at 'Resource does not exist u8'.
Good catch. Looks like the true culprit here is this default impl:

I used rust-analyzer's "add missing items" completion to implement System, which doesn't populate default impls. Not quite sure why I added that default impl in the first place.
Should be a straightforward fix.
Most helpful comment
Good catch. Looks like the true culprit here is this default impl:
I used rust-analyzer's "add missing items" completion to implement System, which doesn't populate default impls. Not quite sure why I added that default impl in the first place.
Should be a straightforward fix.