Skip to content

Implementing trait for Existential type ICE's #53345

Closed
@DutchGhost

Description

@DutchGhost

Trying to implement a trait for an existential type, ICE's:

#![feature(existential_type)]

existential type Bar: PartialEq;

fn bazr() -> Bar { }

impl Eq for Bar {}

fn main() {}
Backtrace:
 Compiling playground v0.0.1 (file:///playground)
error: internal compiler error: librustc/traits/coherence.rs:487: ty_is_local invoked on unexpected type: Bar

thread 'main' panicked at 'Box<Any>', librustc_errors/lib.rs:579:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:479
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::bug
   8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
   9: rustc::ty::context::tls::with_opt::{{closure}}
  10: rustc::ty::context::tls::with_context_opt
  11: rustc::ty::context::tls::with_opt
  12: rustc::util::bug::opt_span_bug_fmt
  13: rustc::util::bug::bug_fmt
  14: rustc::traits::coherence::ty_is_local_constructor
  15: rustc::traits::coherence::ty_is_local
  16: rustc::traits::coherence::orphan_check_trait_ref
  17: rustc::traits::coherence::orphan_check
  18: <rustc_typeck::coherence::orphan::OrphanChecker<'cx, 'tcx> as rustc::hir::itemlikevisit::ItemLikeVisitor<'v>>::visit_item
  19: rustc::hir::Crate::visit_all_item_likes
  20: rustc_typeck::check_crate::{{closure}}::{{closure}}
  21: rustc_typeck::check_crate
  22: rustc::ty::context::tls::enter_context
  23: <std::thread::local::LocalKey<T>>::with
  24: rustc::ty::context::TyCtxt::create_and_enter
  25: rustc_driver::driver::compile_input
  26: rustc_driver::run_compiler_with_pool
  27: syntax::with_globals
  28: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  29: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  30: rustc_driver::run
  31: rustc_driver::main
  32: std::rt::lang_start::{{closure}}
  33: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  34: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  35: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  36: main
  37: __libc_start_main
  38: <unknown>
query stack during panic:
end of query stack
error: aborting due to previous error


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.30.0-nightly (d5a448b3f 2018-08-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `playground`.

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

Labels

A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions