bevyengine / bevyengine/bevy

Trying to iterate &Res<Assets<T>> results in a poor compiler error

Open
#16,002 2 comments 0 reactions 0 assignees View on GitHub
A-Cross-Cutting C-Bug C-Usability S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

```rust
for mesh in &meshes {}
```

```rust
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`scene_viewer`)
= note: required for `&bevy::prelude::Res<'_, _>` to implement `IntoIterator`
= note: 126 redundant requirements hidden
= note: required for `&Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, Res<'_, ...>>>>>>>>>>>>>>>>>>>>>>>>` to implement `IntoIterator`
= note: the full name for the type has been written to '.long-type-3364561052137337366.txt'
= note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0275`.
```

Increasing the recursion limit to 256 then says it overflows and suggest increasing to 512, ongoing forever.

The correct solution seems to be using meshes.iter(). I'm curious why that is.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.