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

ICE with existential associated type #54899

Open
Seeker14491 opened this issue Oct 8, 2018 · 3 comments

Comments

@Seeker14491
Copy link
Contributor

commented Oct 8, 2018

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(())
    }
}

Playground

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.

@zackmdavis zackmdavis added the I-ICE label Oct 8, 2018

@eddyb

This comment has been minimized.

Copy link
Member

commented Nov 22, 2018

@oli-obk oli-obk self-assigned this Jan 25, 2019

@oli-obk

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2019

related to #53678

both seem to not fully resolve all associated types

@Aaron1011

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2019

This compiles successfully on the latest nightly.

Centril added a commit to Centril/rust that referenced this issue Jul 29, 2019

Rollup merge of rust-lang#63096 - Centril:existential-type-add-tests,…
… r=varkor

Add tests for some `existential_type` ICEs

Fix rust-lang#53678
Fix rust-lang#60407
Fix rust-lang#60564

rust-lang#54899 will need some minimization before it can be added.

r? @varkor

Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019

Rollup merge of rust-lang#63096 - Centril:existential-type-add-tests,…
… r=varkor

Add tests for some `existential_type` ICEs

Fix rust-lang#53678
Fix rust-lang#60407
Fix rust-lang#60564

rust-lang#54899 will need some minimization before it can be added.

r? @varkor

Centril added a commit to Centril/rust that referenced this issue Jul 30, 2019

Rollup merge of rust-lang#63096 - Centril:existential-type-add-tests,…
… r=varkor

Add tests for some `existential_type` ICEs

Fix rust-lang#53678
Fix rust-lang#60407
Fix rust-lang#60564

rust-lang#54899 will need some minimization before it can be added.

r? @varkor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.