Unhelpful error message for missing `+ use<>` in piped system
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
Since [Rust 2024](https://blog.rust-lang.org/2024/10/17/Rust-1.82.0/#precise-capturing-use-syntax), returning `impl Trait` from a fn implicitly captures lifetimes from the fn parameters. In Bevy, writing a piped system that uses this causes a compile error if the system has basically any parameters, due to the `Out: 'static` bound on the `pipe` method (I think?), and the ubiquitous `'w` lifetime parameters present on system parameters:
```rust
fn plugin(app: &mut App) {
app.add_systems(Startup, make_scene.pipe(spawn_scene));
}
fn make_scene(res: Res) -> impl Scene {
bsn! { /* ... */ }
}
fn spawn_scene(In(scene): In, mut commands: Commands) {
commands.spawn_scene(scene.0);
}
```
This example fails with ``error[E0599]: no method named `pipe` found for fn item /* ... */ in the current scope``. The correct fix is to change the return value of `make_scene` to `-> impl Scene + use<>`, but I have no idea how you're supposed to figure that out.
Contributor guide
Assessment
This issue has not been assessed yet.