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

Unreachable code generated by try_join! with never error #1992

Closed
Nemo157 opened this issue Nov 26, 2019 · 1 comment · Fixed by #2000
Closed

Unreachable code generated by try_join! with never error #1992

Nemo157 opened this issue Nov 26, 2019 · 1 comment · Fixed by #2000

Comments

@Nemo157
Copy link
Member

Nemo157 commented Nov 26, 2019

This is currently causing CI failures because one of the tests inadvertently triggers it.

Given a crate with:

async fn foo() -> Result<(), !> {
    Ok(())
}

pub async fn bar() {
    let _: Result<((), ()), !> = futures::try_join!(foo(), foo());
}

compiling it produces two unreachable call warnings pointing at the try_join!:

warning: unreachable call
 --> src/lib.rs:6:34
  |
6 |     let _: Result<((), ()), !> = futures::try_join!(foo(), foo());
  |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |                                  |
  |                                  unreachable call
  |                                  any code following this expression is unreachable
  |
  = note: `#[warn(unreachable_code)]` on by default
  = note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

(-Z external-macro-backtrace doesn't give anything useful).

@Nemo157
Copy link
Member Author

Nemo157 commented Nov 26, 2019

(This recently started failing in CI because the FutureExt::never_error combinator started producing a true ! instead of the temporary core::convert::Infallible, and it appears rustc has better dead code detection (or a bug) based on this specific type).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant