Closed

Description
I was using impl Trait
and the futures
library when I got an ICE. I managed to reduce it to the following example:
edit: Updated example
#![feature(conservative_impl_trait)]
extern crate futures;
use futures::Future;
pub fn give_future() -> impl Future<Item=u32,Error=()> {
futures::finished(1)
}
pub fn bug() {
let fut1 = futures::finished(1);
let fut2 = futures::finished(())
.and_then(|_| {
give_future()
});
fut1.join(fut2);
}
error: internal compiler error: ../src/librustc_trans/type_of.rs:154: Unexpected tail in unsized_info_ty: futures::join::MaybeDone<futures::AndThen<futures::Finished<(), ()>, futures::Finished<u32, ()>, [closure@src/lib.rs:15:19: 17:10]>> for ty=futures::join::MaybeDone<futures::AndThen<futures::Finished<(), ()>, futures::Finished<u32, ()>, [closure@src/lib.rs:15:19: 17:10]>>
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'Box<Any>', ../src/librustc_errors/lib.rs:656
stack backtrace:
1: 0x7f32fee74aef - std::sys::backtrace::tracing::imp::write::h22f199c1dbb72ba2
2: 0x7f32fee8401d - std::panicking::default_hook::{{closure}}::h9a389c462b6a22dd
3: 0x7f32fee81496 - std::panicking::default_hook::h852b4223c1c00c59
4: 0x7f32fee81b78 - std::panicking::rust_panic_with_hook::hcd9d05f53fa0dafc
5: 0x7f32fb2b8607 - std::panicking::begin_panic::h2f463d37998ebeba
6: 0x7f32fb2c8768 - rustc_errors::Handler::bug::haca77c19c882b432
7: 0x7f32fc31da9a - rustc::session::opt_span_bug_fmt::{{closure}}::hfeb850fbe828b399
8: 0x7f32fc25cba5 - rustc::session::opt_span_bug_fmt::h46e45438a860a75e
9: 0x7f32fc25c9e2 - rustc::session::bug_fmt::hde22f071bf5a80ea
10: 0x7f32fdab3529 - rustc_trans::type_of::unsized_info_ty::h3691d330280e0b84
11: 0x7f32fdab3cad - rustc_trans::type_of::in_memory_type_of::h125eed35c11bfd7e
12: 0x7f32fdac15c6 - rustc_trans::abi::FnType::unadjusted::{{closure}}::h08a86fd257e9f006
13: 0x7f32fda1d958 - rustc_trans::abi::FnType::unadjusted::h86a7b5168034e32a
14: 0x7f32fda70629 - rustc_trans::declare::declare_fn::hd68e68443a787ee8
15: 0x7f32fdaac871 - rustc_trans::trans_item::TransItem::predefine::hc4cd0f9fb130714e
16: 0x7f32fda2eee0 - rustc_trans::base::trans_crate::h9b06de31ed8799d1
17: 0x7f32ff209d4d - rustc_driver::driver::phase_4_translate_to_llvm::hc3883ea2c4750179
18: 0x7f32ff244cf7 - rustc_driver::driver::compile_input::{{closure}}::h9162a2fa292aeb3f
19: 0x7f32ff23bef3 - rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::h1928c4704cfe9c61
20: 0x7f32ff2076ed - rustc_driver::driver::phase_3_run_analysis_passes::he578df6b8805151c
21: 0x7f32ff1f3f69 - rustc_driver::driver::compile_input::h5b63ccd49eeeb98b
22: 0x7f32ff21d2ba - rustc_driver::run_compiler::h98c7274e7cb1d11d
23: 0x7f32ff156f0b - std::panicking::try::do_call::h99ed0da044e497c3
24: 0x7f32fee8bf16 - __rust_maybe_catch_panic
25: 0x7f32ff175461 - <F as alloc::boxed::FnBox<A>>::call_box::hbdd5a14cd8e33b97
26: 0x7f32fee7fef0 - std::sys::thread::Thread::new::thread_start::h50b05608a499d2b2
27: 0x7f32f71536f9 - start_thread
28: 0x7f32feb43b5c - clone
29: 0x0 - <unknown>
It happened on a ~week-old nightly version, and then on the latest version.
$ rustc --version --verbose
rustc 1.14.0-nightly (a3bc191b5 2016-10-10)
binary: rustc
commit-hash: a3bc191b5f41df5143cc65084b13999896411817
commit-date: 2016-10-10
host: x86_64-unknown-linux-gnu
release: 1.14.0-nightly