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

Fix CI failures #2000

Merged
merged 2 commits into from Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -129,7 +129,7 @@ matrix:
- name: cargo check (features)
rust: nightly
install:
- cargo install -Z install-upgrade cargo-hack
- cargo install cargo-hack
script:
# Check each specified feature works properly
# * `--each-feature` - run for each feature which includes --no-default-features and default features of package
Expand Down
4 changes: 4 additions & 0 deletions futures-macro/src/join.rs
Expand Up @@ -129,6 +129,8 @@ pub(crate) fn try_join(input: TokenStream) -> TokenStream {
} else if unsafe { #futures_crate::core_reexport::pin::Pin::new_unchecked(&mut #fut) }.output_mut().unwrap().is_err() {
// `.err().unwrap()` rather than `.unwrap_err()` so that we don't introduce
// a `T: Debug` bound.
// Also, for an error type of ! any code after `err().unwrap()` is unreachable.
#[allow(unreachable_code)]
return #futures_crate::core_reexport::task::Poll::Ready(
#futures_crate::core_reexport::result::Result::Err(
unsafe { #futures_crate::core_reexport::pin::Pin::new_unchecked(&mut #fut) }.take_output().unwrap().err().unwrap()
Expand All @@ -141,6 +143,8 @@ pub(crate) fn try_join(input: TokenStream) -> TokenStream {
quote! {
// `.ok().unwrap()` rather than `.unwrap()` so that we don't introduce
// an `E: Debug` bound.
// Also, for an ok type of ! any code after `ok().unwrap()` is unreachable.
#[allow(unreachable_code)]
unsafe { #futures_crate::core_reexport::pin::Pin::new_unchecked(&mut #fut) }.take_output().unwrap().ok().unwrap(),
}
});
Expand Down
23 changes: 23 additions & 0 deletions futures/tests/try_join.rs
@@ -0,0 +1,23 @@
#![deny(unreachable_code)]

use futures::{try_join, executor::block_on};

#[test]
fn try_join_never_error() {
block_on(async {
let future1 = async { Ok::<(), !>(()) };
let future2 = async { Ok::<(), !>(()) };
try_join!(future1, future2)
})
.unwrap();
}

#[test]
fn try_join_never_ok() {
block_on(async {
let future1 = async { Err::<!, ()>(()) };
let future2 = async { Err::<!, ()>(()) };
try_join!(future1, future2)
})
.unwrap_err();
}