Skip to content

async-await: mutually recursive functions compile sometimes #64004

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

Closed
mb64 opened this issue Aug 29, 2019 · 2 comments · Fixed by #64038
Closed

async-await: mutually recursive functions compile sometimes #64004

mb64 opened this issue Aug 29, 2019 · 2 comments · Fixed by #64038
Assignees
Labels
A-async-await Area: Async & Await AsyncAwait-Polish Async-await issues that are part of the "polish" area

Comments

@mb64
Copy link

mb64 commented Aug 29, 2019

In the following code:

async fn rec_1() {
    rec_2().await;
}

async fn rec_2() {
    rec_1().await;
}

This gives an error when it is a part of a lib crate. However, as a part of a bin crate, it compiles.

Here's an erroneously compiling playground link and a correctly erroring playground link

@matprec
Copy link
Contributor

matprec commented Aug 29, 2019

I guess that's because in the binary, it knows that it will be unused. If you were to actually use it, it errors

@matthewjasper matthewjasper self-assigned this Aug 29, 2019
@cramertj cramertj added A-async-await Area: Async & Await AsyncAwait-Polish Async-await issues that are part of the "polish" area labels Aug 30, 2019
@cramertj
Copy link
Member

Tagging as blocking because fixing this is a potential future-compat hazard.

Centril added a commit to Centril/rust that referenced this issue Sep 5, 2019
…t-recursion, r=varkor

Check impl trait substs when checking for recursive types

closes rust-lang#64004
@bors bors closed this as completed in 9024032 Sep 5, 2019
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 AsyncAwait-Polish Async-await issues that are part of the "polish" area
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants