You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
error[E0275]: overflow evaluating the requirement &_: IntoIterator does not show a line number #118476
In the compiler rustc 1.76.0-nightly (37b2813 2023-11-24).
Summary
Still learning the language so sorry if this isn't super detailed, I wrote a type and got this error message:
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`bevy_game`)
= note: required for `&bevy::prelude::ResMut<'_, _>` to implement `IntoIterator`
= note: 126 redundant requirements hidden
= note: required for `&ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ResMut<'_, ...>>>>>>>>>>` to implement `IntoIterator`
= note: the full type name has been written to '<project-folder>/target/debug/deps/bevy_game-f668298e2ba0aa7c.long-type-4538768014950909176.txt'
The problem is I'm not sure where this is broken and the error message doesn't provide a line number of any kind for the problematic code.
I recalled in a talk that we should be filing documentation issues as bugs so I thought I'd drop this here, please let me know if that was in error.
Reacted by Kamil, Connor Meehan, neju como, Michael Pfaff and colinjneville
@Folcon: Please provide any reproduction instructions here if you have them, and ideally any code that can be built. Also, I don't think this issue makes it clear that you encountered this issue (what I'm guessing) in rustdoc/cargo doc. Is this correct?
In terms of a minimal repro case, after I reported the error I managed to fix it and I'm not certain how I did so unfortunately. I'm still in the process of learning rust as a I mentioned. Otherwise I'd give you a better error or have built a minimal repro case =)...
Please let me know if there's anything else I can help with.
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`nadi_core`)
= note: required for `&joinery::join::Join<_, _>` to implement `IntoIterator`
= note: 126 redundant requirements hidden
= note: required for `&Join<Join<Join<Join<Join<Join<Join<Join<Join<Join<Join<Join<..., ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>, ...>` to implement `IntoIterator`
= note: the full type name has been written to '/home/gaurav/github/nadi/target/release/deps/nadi_core.long-type-6255917270899944681.txt'
For more information about this error, try `rustc --explain E0275`.
It doesn't have line number. It was hard to trace what was causing it. But I found it's due to the following code:
The green is the fix I did. So in this case looks like the toml::Tablefrom toml crate being converted into "Iter" was a problem. The internal error could be due to serde and other things it uses. But without the line numbers I can only tell this fixed it.
I tried to recreate the example in playground, and it doesn't allow me to compile unless I add the type for the expand. Maybe in my complete code, it was trying to guess the hint for .into() and got into a loop.
This is an annoying issue because if some library changes the argument of a function from a Vec to impl IntoIterator (a common change) and ANY of your dependencies has an IntoIterator implementation like the one in the example (like palette does), then you may hit this error which renders you completely blind; since there is no context nor mention of the code causing it.
Reacted by Zero, ripytide, MarcusVH98, Sheldon Frith and qasikfwn
error[E0283]: type annotations needed
--> <source>:5:23
|
5 | do_something(iter.collect()); // Causes overflow without context
| ------------ ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
| |
| required by a bound introduced by this call
|
= note: cannot satisfy `_: IntoIterator`
note: required by a bound in `do_something`
--> <source>:8:28
|
8 | fn do_something<T>(_: impl IntoIterator<Item = T>) {}
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something`
help: consider specifying the generic argument
|
5 | do_something(iter.collect::<Vec<_>>()); // Causes overflow without context
| ++++++++++
help: consider removing this method call, as the receiver has type `std::iter::Once<{integer}>` and `std::iter::Once<{integer}>: IntoIterator` trivially holds
|
5 - do_something(iter.collect()); // Causes overflow without context
5 + do_something(iter); // Causes overflow without context
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0283`.
Compiler returned: 1
I got this error with Bevy. And also doesn't show the line number where the error occurs(Fortunately I can get where the error occurs). Here's the code below. (rustc 1.78.0 (2024-04-29))
This is the simple map loading function. It reads the txt file and spawn ascii sprite for each character.
fn create_simple_map(
mut commands: Commands,
ascii_sheet: Res<AsciiSheet>
) {
let file = include_str!("../assets/map.txt");
// Spawn ascii sprites for each character, collect them per line, and finally collect all lines of sprite entities.
let tiles: Vec<_> = file.lines().enumerate().flat_map(|(y, line)| {
// These codes occur an error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
// line.char_indices().map(|(x, ch)| {
// ascii_sheet.spawn_ascii_sprite(
// &mut commands,
// Color::rgb(0.9, 0.9, 0.9),
// (x as f32 * TILE_SIZE, y as f32 * TILE_SIZE * -1.0, 100.0).into(),
// ch as usize
// )
// }).collect()
// No error occurs. Works fine!
let mut entities = Vec::<Entity>::new();
for (x, ch) in line.char_indices() {
let e = ascii_sheet.spawn_ascii_sprite(
&mut commands,
Color::rgb(0.9, 0.9, 0.9),
(x as f32 * TILE_SIZE, y as f32 * TILE_SIZE * -1.0, 100.0).into(),
ch as usize
);
entities.push(e);
}
entities
}).collect();
commands.spawn((
TransformBundle::default(),
Name::new("Map")
)).push_children(tiles.as_slice());
}
I've encountered this error in this project when running cargo test on 1.85.0 both with default options and with -Z next-solver. I see from #118476 (comment) and some gh cross-linking that this issue seems partially resolved, but it still appears in this case.
$ cargo --version
cargo 1.85.0 (d73d2caf9 2024-12-31)
$ git rev-parse HEAD
77e5135b1216348c09f36623c66b900481fa6482
$ cargo test
Compiling sappho-syntax-expr v0.1.0 (/home/knack/src/github.com/nathan-at-least/sappho/syntax/expr)
error[E0275]: overflow evaluating the requirement `impl sappho_syntax_parsable::Parser<Expr> == _`
For more information about this error, try `rustc --explain E0275`.
error: could not compile `sappho-syntax-expr` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `sappho-syntax-expr` (lib test) due to 1 previous error
$ cargo test -- -Z next-solver
Compiling sappho-syntax-expr v0.1.0 (/home/knack/src/github.com/nathan-at-least/sappho/syntax/expr)
error[E0275]: overflow evaluating the requirement `impl sappho_syntax_parsable::Parser<Expr> == _`
For more information about this error, try `rustc --explain E0275`.
error: could not compile `sappho-syntax-expr` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `sappho-syntax-expr` (lib test) due to 1 previous error
@nejucomo-Znext-solver is a rustc compilation flag, not a test flag, so passing it to cargo test on the command line does nothing useful.
What you want to do is set it in RUSTFLAGS environment variable or in .cargo/config. Oh and the option is only available on nightly compiler.
(This is all not exactly obvious, I agree)
I have checked out your repository and can confirm that it indeed hits the error with stock rustc, but doesn't with -Znext-solver (it fails to compile with a more "normal" borrowcheck error)
I don't think this is too useful at this point (two years later), but since bisection was requested.
Working with minimization from #118476 (comment)
output as of nightly-2023-10-06 (`error[E0282]: type annotations needed`)
error[E0282]: type annotations needed
--> src\lib.rs:5:5
|
5 | do_something(iter.collect()); // Causes overflow without context
| ^^^^^^^^^^^^ cannot infer type for type parameter `T` declared on the function `do_something`
For more information about this error, try `rustc --explain E0282`.
error: could not compile `mycrate` (lib) due to previous error
output as of nightly-2023-10-07 (`error[E0275]: overflow evaluating the requirement`)
error[E0275]: overflow evaluating the requirement `&_: IntoIterator`
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`mycrate`)
note: required for `&SomeType<_>` to implement `IntoIterator`
--> src\lib.rs:14:13
|
14 | impl<'a, C> IntoIterator for &'a SomeType<C>
| ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
15 | where
16 | &'a C: IntoIterator + 'a
| ------------ unsatisfied trait bound introduced here
= note: 126 redundant requirements hidden
= note: required for `&SomeType<SomeType<SomeType<SomeType<SomeType<SomeType<SomeType<SomeType<...>>>>>>>>` to implement `IntoIterator`
= note: the full type name has been written to '...'
commits in range 2023-10-06 - 2023-10-07
cargo-bisect-rustc gets very confused trying to generate the list of commits, (probably due to clippy tree sync?) so here's unpretty form as a backup: https://github.com/rust-lang/rust/compare/cae0791da47bb01f16885eb233dcd66b0093a6e1...9607540
********************************************************************************
Regression in nightly-2023-10-07
********************************************************************************
fetching https://static.rust-lang.org/dist/2023-10-06/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2023-10-06: 40 B / 40 B [=======================================================] 100.00 % 50.46 KB/s converted 2023-10-06 to cae0791da47bb01f16885eb233dcd66b0093a6e1
fetching https://static.rust-lang.org/dist/2023-10-07/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2023-10-07: 40 B / 40 B [=======================================================] 100.00 % 89.82 KB/s converted 2023-10-07 to 960754090acc9cdd2a5a57586f244c0fc712d26c
looking for regression commit between 2023-10-06 and 2023-10-07
fetching (via remote github) commits from max(cae0791da47bb01f16885eb233dcd66b0093a6e1, 2023-10-04) to 960754090acc9cdd2a5a57586f244c0fc712d26c
ending github query because we found starting sha: cae0791da47bb01f16885eb233dcd66b0093a6e1
get_commits_between returning commits, len: 15
commit[0] 2023-10-05: Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errors
commit[1] 2023-10-06: Auto merge of #116269 - Veykril:rustc-abi, r=WaffleLapkin
commit[2] 2023-10-06: Auto merge of #101150 - jethrogb:jb/cleanup-sgx-user-memory-copies, r=workingjubilee
commit[3] 2023-10-06: Auto merge of #116463 - ChrisDenton:nlibc, r=workingjubilee
commit[4] 2023-10-06: Auto merge of #116472 - matthiaskrgr:rollup-1mz0qrp, r=matthiaskrgr
commit[5] 2023-10-06: Auto merge of #116018 - DianQK:simd-wide-sum-test, r=scottmcm
commit[6] 2023-10-06: Auto merge of #111595 - fortanix:raoul/waitqueue_clarifications, r=workingjubilee
commit[7] 2023-10-06: Auto merge of #116483 - GuillaumeGomez:rollup-z65pno1, r=GuillaumeGomez
commit[8] 2023-10-06: Auto merge of #11611 - Alexendoo:items-after-test-module-check-crate, r=blyxyas
commit[9] 2023-10-06: Auto merge of #115304 - Enselic:trailing-gt, r=cjgillot
commit[10] 2023-10-06: Auto merge of #11628 - koka831:fix/11625, r=blyxyas
commit[11] 2023-10-06: Auto merge of #11629 - flip1995:rustup, r=flip1995
commit[12] 2023-10-06: Auto merge of #116489 - flip1995:clippyup, r=Manishearth
commit[13] 2023-10-06: Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiser
commit[14] 2023-10-06: Auto merge of #116492 - matthiaskrgr:rollup-xzfhmq1, r=matthiaskrgr
ERROR: no CI builds available between cae0791da47bb01f16885eb233dcd66b0093a6e1 and 960754090acc9cdd2a5a57586f244c0fc712d26c within last 167 days
None of the PRs look particularly related, except maybe #114811 ? (but i'm not remotely confident)
Edit: git bisect confirms 91b9ffe / #114811
Later un-regressed:
output as of nightly-2024-04-15 (`error[E0283]: type annotations needed` again)
error[E0283]: type annotations needed
--> src\lib.rs:5:23
|
5 | do_something(iter.collect()); // Causes overflow without context
| ------------ ^^^^^^^ cannot infer type of the type parameter `B` declared on the method `collect`
| |
| required by a bound introduced by this call
|
= note: cannot satisfy `_: IntoIterator`
note: required by a bound in `do_something`
--> src\lib.rs:8:28
|
8 | fn do_something<T>(_: impl IntoIterator<Item = T>) {}
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `do_something`
help: consider specifying the generic argument
|
5 | do_something(iter.collect::<Vec<_>>()); // Causes overflow without context
| ++++++++++
help: consider removing this method call, as the receiver has type `std::iter::Once<{integer}>` and `std::iter::Once<{integer}>: IntoIterator` trivially holds
|
5 - do_something(iter.collect()); // Causes overflow without context
5 + do_something(iter); // Causes overflow without context
|
For more information about this error, try `rustc --explain E0283`.
cargo-bisect-rustc output
********************************************************************************
Regression in nightly-2024-04-15
********************************************************************************
fetching https://static.rust-lang.org/dist/2024-04-14/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-04-14: 40 B / 40 B [=======================================================] 100.00 % 53.95 KB/s converted 2024-04-14 to 0bf471f339837af930ec90ef5e1e9cb232e99f29
fetching https://static.rust-lang.org/dist/2024-04-15/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2024-04-15: 40 B / 40 B [=======================================================] 100.00 % 43.02 KB/s converted 2024-04-15 to 0d8b3346a3992ab11ea35ff0fb95a6864b91f797
looking for regression commit between 2024-04-14 and 2024-04-15
fetching (via remote github) commits from max(0bf471f339837af930ec90ef5e1e9cb232e99f29, 2024-04-12) to 0d8b3346a3992ab11ea35ff0fb95a6864b91f797
ending github query because we found starting sha: 0bf471f339837af930ec90ef5e1e9cb232e99f29
get_commits_between returning commits, len: 8
commit[0] 2024-04-13: Auto merge of #123644 - dtolnay:cc, r=Mark-Simulacrum
commit[1] 2024-04-14: Auto merge of #123819 - joboet:fmt_usize_marker, r=Mark-Simulacrum
commit[2] 2024-04-14: Auto merge of #107462 - WaffleLapkin:from_iterator_for_tuple, r=dtolnay
commit[3] 2024-04-14: Auto merge of #123580 - rust-lang:cargo_update, r=Mark-Simulacrum
commit[4] 2024-04-14: Auto merge of #123913 - matthiaskrgr:rollup-w8stnwl, r=matthiaskrgr
commit[5] 2024-04-14: Auto merge of #122268 - ChrisDenton:no-libc, r=Mark-Simulacrum
commit[6] 2024-04-14: Auto merge of #123719 - RalfJung:compiler_builtins, r=Mark-Simulacrum
commit[7] 2024-04-14: Auto merge of #123945 - GuillaumeGomez:rollup-14x3enh, r=GuillaumeGomez
ERROR: no CI builds available between 0bf471f339837af930ec90ef5e1e9cb232e99f29 and 0d8b3346a3992ab11ea35ff0fb95a6864b91f797 within last 167 days
Even though the existing mcve compiles with stock rustc presently, it might still be worth minimizing either the bevy (#118476 (comment)) or the sappho (#118476 (comment)) example down to a form that still fails on nightly, as a test case.
I was unable to reproduce the toml example (#118476 (comment))
Not sure if I'm adding anything substantial, but I can confirm this issue still persists with a minimal bevy install on nightly-2025-08-12-aarch64-apple-darwin. -Znext-solver doesnt fix it, neither does -Znext-solver=coherence.
I have a potentially related issue, in fact, very likely the same issue. We use rustc 1.94.0 (4a4ef493e 2026-03-02). What is strange that the compilation error only happens on MacOS. Windows, Linux, Android builds are just fine. Since I am in a release rush and has just bitten by it right now (and had to apply a workaround), I cannot give you a reproducer atm - but since it is in a small helper function I can very likely give you a reproducer sometime this week.
(my project has nothing to do with bevy, my issue is similar though)
I am encountering an issue that may be the same as @drewhk's and @juliankrieger, since it only occurred on MacOS to begin with, but I tracked it down to a crate (dispatch2) that was only pulled in for MacOS targets and was able to come up with a self-contained reproducer that does not require dispatch2. Are your issues related to dispatch2::retained::DispatchRetained?
If the impl Trait for &'a Unrelated exists anywhere the compiler can see it, even in a transitive dependency of some random crate, the compiler gets lost trying to evaluate the requirements at the with_requirement() callsite, even if the type is super obvious at the callsite.
In my specific case, I'm having trouble with the Seek impl.
Activity
compiler-errors commentedon Nov 30, 2023
@Folcon: Please provide any reproduction instructions here if you have them, and ideally any code that can be built. Also, I don't think this issue makes it clear that you encountered this issue (what I'm guessing) in
rustdoc/cargo doc. Is this correct?Folcon commentedon Nov 30, 2023
@compiler-errors, I found this while running cargo run, so I'm assuming the rust compiler.
I encountered it developing a bevy project, I can't share the code.
The project uses
#![feature(box_patterns)]but I'm not certain it's relevant.The full type name that appears in the text file generated is below:
In terms of a minimal repro case, after I reported the error I managed to fix it and I'm not certain how I did so unfortunately. I'm still in the process of learning rust as a I mentioned. Otherwise I'd give you a better error or have built a minimal repro case =)...
Please let me know if there's anything else I can help with.
compiler-errors commentedon Nov 30, 2023
Ok, I was just confused why this issue was tagged "docs"
bas-ie commentedon Jan 20, 2024
I just hit this too with 12.1. If I fix it, I'll let you know what it was! 😆
Atreyagaurav commentedon Feb 10, 2024
I also got this recently.
It doesn't have line number. It was hard to trace what was causing it. But I found it's due to the following code:
The green is the fix I did. So in this case looks like the
toml::Tablefrom toml crate being converted into "Iter" was a problem. The internal error could be due to serde and other things it uses. But without the line numbers I can only tell this fixed it.pub fn with_args(args: Vec<toml::Value>) -> Self { let mut ctx = Self::new(); - args.iter().filter_map(|a| a.as_table()).for_each(|t| { - ctx.kwargs.extend(t.into()); - }); - ctx.args = args; + ctx.args = args.clone(); + args.into_iter() + .filter_map(|a| a.as_table().cloned()) + .for_each(|t| { + ctx.kwargs.extend(t); + }); ctx }EDIT:
I want to add that
Selfhere is:So converting
toml::Tablewhich can contain othertoml::Tablecould be the reason.Atreyagaurav commentedon Feb 10, 2024
I tried to recreate the example in playground, and it doesn't allow me to compile unless I add the type for the
expand. Maybe in my complete code, it was trying to guess the hint for.into()and got into a loop.https://play.rust-lang.org/?version=stable&mode=release&edition=2021&gist=ab4332b2a303f490f6518572cb83d7ab
hecrj commentedon Feb 23, 2024
Here is a simpler example with no external dependencies that reproduces the issue in stable:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=ec772634936a120b6c935475d6c831be
This is an annoying issue because if some library changes the argument of a function from a
Vectoimpl IntoIterator(a common change) and ANY of your dependencies has anIntoIteratorimplementation like the one in the example (likepalettedoes), then you may hit this error which renders you completely blind; since there is no context nor mention of the code causing it.jieyouxu commentedon Feb 28, 2024
With
-Z next-solver:oddman621 commentedon Jun 20, 2024
I got this error with Bevy. And also doesn't show the line number where the error occurs(Fortunately I can get where the error occurs). Here's the code below. (rustc 1.78.0 (2024-04-29))
This is the simple map loading function. It reads the txt file and spawn ascii sprite for each character.
nejucomo commentedon Mar 8, 2025
I've encountered this error in this project when running
cargo teston1.85.0both with default options and with-Z next-solver. I see from #118476 (comment) and some gh cross-linking that this issue seems partially resolved, but it still appears in this case.moxian commentedon Mar 11, 2025
@nejucomo
-Znext-solveris a rustc compilation flag, not a test flag, so passing it tocargo teston the command line does nothing useful.What you want to do is set it in
RUSTFLAGSenvironment variable or in .cargo/config. Oh and the option is only available on nightly compiler.(This is all not exactly obvious, I agree)
I have checked out your repository and can confirm that it indeed hits the error with stock rustc, but doesn't with
-Znext-solver(it fails to compile with a more "normal" borrowcheck error)moxian commentedon Mar 11, 2025
I don't think this is too useful at this point (two years later), but since bisection was requested.
Working with minimization from #118476 (comment)
output as of nightly-2023-10-06 (`error[E0282]: type annotations needed`)
output as of nightly-2023-10-07 (`error[E0275]: overflow evaluating the requirement`)
commits in range 2023-10-06 - 2023-10-07
cargo-bisect-rustc gets very confused trying to generate the list of commits, (probably due to clippy tree sync?) so here's unpretty form as a backup: https://github.com/rust-lang/rust/compare/cae0791da47bb01f16885eb233dcd66b0093a6e1...9607540None of the PRs look particularly related, except maybe #114811 ?
(but i'm not remotely confident)Edit:
git bisectconfirms 91b9ffe / #114811Later un-regressed:
output as of nightly-2024-04-15 (`error[E0283]: type annotations needed` again)
cargo-bisect-rustc output
Sounds like #123618 (or somewhat unlikely #107462 ?)
Even though the existing mcve compiles with stock rustc presently, it might still be worth minimizing either the bevy (#118476 (comment)) or the sappho (#118476 (comment)) example down to a form that still fails on nightly, as a test case.
I was unable to reproduce the toml example (#118476 (comment))
@rustbot label: -E-needs-bisection +E-needs-mcve +A-inference -A-codegen
juliankrieger commentedon Aug 12, 2025
Not sure if I'm adding anything substantial, but I can confirm this issue still persists with a minimal
bevyinstall onnightly-2025-08-12-aarch64-apple-darwin.-Znext-solverdoesnt fix it, neither does-Znext-solver=coherence.drewhk commentedon Mar 16, 2026
I have a potentially related issue, in fact, very likely the same issue. We use
rustc 1.94.0 (4a4ef493e 2026-03-02). What is strange that the compilation error only happens on MacOS. Windows, Linux, Android builds are just fine. Since I am in a release rush and has just bitten by it right now (and had to apply a workaround), I cannot give you a reproducer atm - but since it is in a small helper function I can very likely give you a reproducer sometime this week.(my project has nothing to do with bevy, my issue is similar though)
feat: add native image preview support
collinmay commentedon Apr 24, 2026
I am encountering an issue that may be the same as @drewhk's and @juliankrieger, since it only occurred on MacOS to begin with, but I tracked it down to a crate (dispatch2) that was only pulled in for MacOS targets and was able to come up with a self-contained reproducer that does not require dispatch2. Are your issues related to
dispatch2::retained::DispatchRetained?https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=beee682ee367e6d57a07310ed5f65dbc
If the
impl Trait for &'a Unrelatedexists anywhere the compiler can see it, even in a transitive dependency of some random crate, the compiler gets lost trying to evaluate the requirements at thewith_requirement()callsite, even if the type is super obvious at the callsite.In my specific case, I'm having trouble with the
Seekimpl.