bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.26k stars 3.58k forks source link

overflow evaluating the requirement &_: IntoIterator #15165

Open ShadowMitia opened 2 months ago

ShadowMitia commented 2 months ago

Bevy version

0.14.2

What you did

Refactored.... :smile: So an unfortunate refactor started giving me the error. I had a Query argument that got changed to a Res, but there was a for-loop that was iterating over said argument that never got changed...

Here is a minimal example that reproduces the problem:

use bevy::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .run();
}

#[derive(Resource)]
struct Test;

// fn setup(mut toto: Query<...things...>) { // before refactoring
fn setup(mut toto: Res<Test>) {
    for toto in &mut toto { // Ruh roh
        println!("toto");
    }
}

What went wrong

Got the error "error[E0275]: overflow evaluating the requirement &_: IntoIterator" without any line information or concrete information of any kind... Fortunately I hadn't made many modifications and could quickly track down the source of the problem.

Full error:

   Compiling brackeys-12 v0.1.0 (/home/dimitri/Sync/brackeys-12)
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
  |
  = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`brackeys_12`)
  = 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<'_, ...>>>>>>>>>>>>>>>` to implement `IntoIterator`
  = note: the full name for the type has been written to '/home/dimitri/Sync/brackeys-12/target/debug/deps/brackeys_12-fa5e68070df7b6bc.long-type-6635115335326429453.txt'
  = note: consider using `--verbose` to print the full type name to the console

For more information about this error, try `rustc --explain E0275`.
error: could not compile `brackeys-12` (bin "brackeys-12") due to 1 previous error

Additional information

Seems related to https://github.com/rust-lang/rust/issues/118476 for the part where there is no line information whatsoever.

The full type name just because it's amusing:

&bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, bevy::prelude::Res<'_, _>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
MrGVSV commented 2 months ago

Related: #14799