-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Unhelpful "overflow evaluating the requirement" error for infinitely recursive generators #46415
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Got the same error, using the |
Getting the same error, by adapting my project using |
After updated to the latest nightly rust. The error message have been changed.
It compiled with no error. |
This now gives the following error, which is still not particularly great.
|
Recursive closures also give a similar error:
#![feature(conservative_impl_trait)]
fn foo() -> impl Fn() {
let t = foo();
move || {
t();
}
}
fn main() {
(foo())();
} |
So this is no longer an ICE. The |
I'm currently running into this while porting
Is there a way to get information about which For completeness, if I increase the recursion limit the way it suggests up to 8192, rustc eventually crashes with
|
* Add rustfmt.toml for 2018 edition fmt * Part-way there * Closer to upstream tokio * No more MyFuture * Port tests * More stuff to async fn * Use ? in tests over unwrap * Workaround for rust-lang/rust#46415 * All tests pass * async/await is only on nightly for now * Only nightly on circle as well * CI is hard * Prep for async named pipes * Don't fail tests if local infiles aren't supported * No more workaround for taiki-e/pin-project#68 * Attempt at windows support * PollEvented in tokio_net::util * Avoid compilation error in Transaction::new * Fix compilation error in tls::connect_async() * Fix benches. Add SSL env var for tests. * Test SSL during CI * Bump dependencies
This code: #![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
fn foo() -> impl Generator<Yield = (), Return = ()> {
|| {
let mut gen = Box::pin(foo());
let mut r = gen.as_mut().resume(());
while let GeneratorState::Yielded(v) = r {
yield v;
r = gen.as_mut().resume(());
}
}
}
fn main() {
foo();
} Now errors with "recursive opaque type":
I personally consider this sufficient. Drilling down the generator any further to explain why it's recursive (i.e. explain its upvars) would be nice, but I don't think it's necessarily required. I'll open a new PR for that. |
…losure, r=TaKO8Ki Label closure captures/generator locals that make opaque types recursive cc rust-lang#46415 (comment)
…losure, r=TaKO8Ki Label closure captures/generator locals that make opaque types recursive cc rust-lang#46415 (comment)
…losure, r=TaKO8Ki Label closure captures/generator locals that make opaque types recursive cc rust-lang#46415 (comment)
Obviously this shouldn't actually work, due to the state type being infinitely sized (at least not without
become
/TCO for generators), but it should generate an error similar to recursive types.playground link
Program:
Output:
Expected (something like):
The text was updated successfully, but these errors were encountered: