Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async/await assertion failed: unbounded recursion #53249

Closed
Ekleog opened this issue Aug 10, 2018 · 6 comments · Fixed by #60243
Closed

async/await assertion failed: unbounded recursion #53249

Ekleog opened this issue Aug 10, 2018 · 6 comments · Fixed by #60243
Assignees
Labels
A-async-await Area: Async & Await A-closures Area: Closures (`|…| { … }`) A-diagnostics Area: Messages for errors, warnings, and lints AsyncAwait-Polish Async-await issues that are part of the "polish" area E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@Ekleog
Copy link

Ekleog commented Aug 10, 2018

(edit: much simpler reproducer at second post)

(see edit history for the initial issue text)

Potential duplicate of #49537 and #51624

cc #50547

@Ekleog
Copy link
Author

Ekleog commented Aug 10, 2018

(edit: updated to nightly from 2018-08-14, as the error message changed)

Another simpler reproducer:

#![feature(async_await, await_macro, futures_api)]

use futures::prelude::*;

async fn __receive<WantFn, Fut>(want: WantFn) -> ()
where
    Fut: Future<Output = ()>,
    WantFn: Fn(&Box<Send + 'static>) -> Fut,
{
    await!(futures::future::lazy(|_| ()));
}

pub fn basic_spawn_receive() {
    async { await!(__receive(|_| async { () })) };
}

Cargo.toml:

cargo-features = ["edition"]

[package]
name = "erlust"
edition = "2018"
version = "0.1.0"

[dependencies.futures-preview]
git = "https://github.com/rust-lang-nursery/futures-rs"
rev = "c02ec75a155485ff4b50f21205b6a462851b08e1"

Backtrace:

error[E0275]: overflow evaluating the requirement `[closure@erlust/src/lib.rs:10:34: 10:40]: std::marker::Freeze`
  |
  = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
  = note: required because of the requirements on the impl of `std::marker::Freeze` for `[closure@erlust/src/lib.rs:10:34: 10:40]`
[]
  = note: required because of the requirements on the impl of `std::marker::Freeze` for `[closure@erlust/src/lib.rs:10:34: 10:40]`
  = note: required because it appears within the type `std::option::Option<[closure@erlust/src/lib.rs:10:34: 10:40]>`
  = note: required because it appears within the type `futures_util::future::lazy::Lazy<[closure@erlust/src/lib.rs:10:34: 10:40]>`
  = note: required because it appears within the type `{futures_util::future::lazy::Lazy<[closure@erlust/src/lib.rs:10:34: 10:40]>, ()}`
  = note: required because it appears within the type `[static generator@erlust/src/lib.rs:9:1: 11:2 {futures_util::future::lazy::Lazy<[closure@erlust/src/lib.rs:10:34: 10:40]>, ()}]`
  = note: required because it appears within the type `std::future::GenFuture<[static generator@erlust/src/lib.rs:9:1: 11:2 {futures_util::future::lazy::Lazy<[closure@erlust/src/lib.rs:10:34: 10:40]>, ()}]>`
  = note: required because it appears within the type `impl core::future::future::Future`
  = note: required because it appears within the type `impl core::future::future::Future`
  = note: required because it appears within the type `for<'r> {impl core::future::future::Future, ()}`
  = note: required because it appears within the type `[static generator@erlust/src/lib.rs:14:11: 14:50 for<'r> {impl core::future::future::Future, ()}]`
  = note: required because it appears within the type `std::future::GenFuture<[static generator@erlust/src/lib.rs:14:11: 14:50 for<'r> {impl core::future::future::Future, ()}]>`
  = note: required because it appears within the type `impl core::future::future::Future`

error: aborting due to previous error

The backtrace looks quite different though, so I guess a fix for this one should also be checked to fix the first example.

@Ekleog
Copy link
Author

Ekleog commented Aug 14, 2018

Latest nightly appears to have fixed the ICE, however it's still making unbounded recursion :)

@estebank estebank added A-diagnostics Area: Messages for errors, warnings, and lints A-closures Area: Closures (`|…| { … }`) labels Jan 19, 2019
@cramertj cramertj added the A-async-await Area: Async & Await label Apr 2, 2019
@nikomatsakis nikomatsakis changed the title async/await assertion failed: !value.has_escaping_regions() async/await assertion failed: unbounded recursion Apr 16, 2019
@nikomatsakis nikomatsakis added the AsyncAwait-Polish Async-await issues that are part of the "polish" area label Apr 16, 2019
@nikomatsakis
Copy link
Contributor

Async-await traige: Marking as blocking pending investigation to understand what is happening.

@davidtwco davidtwco self-assigned this Apr 23, 2019
@davidtwco
Copy link
Member

Alright, so here's what I've worked out so far:

I was able to reproduce the ICE from the original code snippet using the compiler version and library versions from when the issue was reported (nightly-2018-08-05 was the closest version I could find and I had to use patch to make Cargo download versions of libraries that worked). I was then able to confirm that the reproduction supplied in the next comment also triggered the ICE. I was then able to get rid of the external dependencies (mostly by copying in parts of that version of futures) and still get the ICE - here's that test case.

After that, I upgraded to nightly-2018-08-14 as mentioned in the next comment and confirmed that the ICE had been fixed and the unbounded recursion was happening with that same test case. Then, I took that test case that was confirmed to have the problem and tried to run it on the latest nightly - I had to make some minor adjustments as the pin module had changed since August, but I couldn't get the recursion error to happen. I'm inclined to say that this has been fixed at some point - here's what I ended up running.

@davidtwco davidtwco added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 24, 2019
@davidtwco
Copy link
Member

I've submitted #60243 with a regression test for this issue.

@Ekleog if you are able to reproduce this failure on a more recent nightly then feel free to re-open or file a new issue.

davidtwco added a commit to davidtwco/rust that referenced this issue Apr 24, 2019
@Ekleog
Copy link
Author

Ekleog commented Apr 24, 2019

Sounds good to me, thanks!

Centril added a commit to Centril/rust that referenced this issue Apr 25, 2019
bors added a commit that referenced this issue Apr 25, 2019
Rollup of 6 pull requests

Successful merges:

 - #59560 (MIR generation cleanup)
 - #59697 (tweak unresolved label suggestion)
 - #60038 (Add codegen test for PGO instrumentation.)
 - #60160 (Fix #58270, fix off-by-one error in error diagnostics.)
 - #60185 (Reexport IntErrorKind in std)
 - #60243 (Add regression test for #53249.)

Failed merges:

r? @ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-async-await Area: Async & Await A-closures Area: Closures (`|…| { … }`) A-diagnostics Area: Messages for errors, warnings, and lints AsyncAwait-Polish Async-await issues that are part of the "polish" area E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants