Closed
Description
The following code causes an ICE:
#![feature(existential_type)]
extern crate futures; // 0.1.24
use futures::{future, Future};
pub struct AStruct;
pub trait ATrait {
type FutureType: Future<Item = (), Error = Self::Error> + Send + 'static;
type Error;
fn a_function(&self) -> Self::FutureType;
}
impl ATrait for AStruct {
existential type FutureType: Future<Item = (), Error = Self::Error> + Send;
type Error = ();
fn a_function(&self) -> Self::FutureType {
future::ok(())
}
}
Compiler output:
error: internal compiler error: broken MIR in DefId(0/0:14 ~ frontend[2c69]::{{impl}}[0]::a_function[0]) (Terminator { source_info: SourceInfo { span: src\lib.rs:19:9: 19:23, scope: scope[0] }, kind: _0 = const futures::future::result_::ok(move _2) -> [return: bb2, unwind: bb1] }): call dest mismatch (futures::future::result_::FutureResult<(), <AStruct as ATrait>::Error> <- futures::future::result_::FutureResult<(), ()>): NoSolution
--> src\lib.rs:19:20
|
19 | future::ok(())
| ^^
thread 'main' panicked at 'no errors encountered even though `delay_span_bug` issued', librustc_errors\lib.rs:334:17
stack backtrace:
0: <std::sync::barrier::BarrierWaitResult as core::fmt::Debug>::fmt
1: <std::path::Iter<'a> as core::convert::AsRef<std::path::Path>>::as_ref
2: std::panicking::take_hook
3: std::panicking::take_hook
4: <rustc::ty::sty::Binder<rustc::ty::ProjectionPredicate<'tcx>> as rustc::ty::ToPredicate<'tcx>>::to_predicate
5: std::panicking::rust_panic_with_hook
6: <rustc_errors::emitter::ColorConfig as core::fmt::Debug>::fmt
7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
8: <rustc_driver::derive_registrar::Finder as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_impl_item
9: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
10: <rustc_driver::profile::trace::Query as core::fmt::Debug>::fmt
11: rustc_driver::target_features::add_configuration
12: _rust_maybe_catch_panic
13: <env_logger::filter::inner::Filter as core::fmt::Display>::fmt
14: rustc_driver::main
15: <unknown>
16: std::panicking::update_panic_count
17: _rust_maybe_catch_panic
18: std::rt::lang_start_internal
19: <unknown>
20: <unknown>
21: BaseThreadInitThunk
22: RtlUserThreadStart
query stack during panic:
end of query stack
error: internal compiler error: unexpected panic
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: rustc 1.31.0-nightly (4efdc04a5 2018-10-06) running on x86_64-pc-windows-msvc
note: compiler flags: -C debuginfo=2 -C incremental --crate-type lib
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `frontend`.
To learn more, run the command again with --verbose.
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Help is requested to fix this issue.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.`#[feature(type_alias_impl_trait)]`Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.
Type
Projects
Status
Done