Skip to content

Internal compiler error with feature type_alias_impl_trait on nightly #76202

Closed
@paullgdc

Description

@paullgdc

The error happens when implementing traits on alias impl Trait

Code

Playground link

#![feature(type_alias_impl_trait)]

trait Dummy {}
impl Dummy for () {}

type F = impl Dummy;
fn f() -> F {}

trait Test {
    fn test(self);
}

impl Test for F {
    fn test(self) {} 
}

fn main() {
    let x: F = f();
    x.test();
}

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (d006f5734 2020-08-28)
binary: rustc
commit-hash: d006f5734f49625c34d6fc33bf6b9967243abca8
commit-date: 2020-08-28
host: x86_64-unknown-linux-gnu
release: 1.48.0-nightly
LLVM version: 11.0

Error output

error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<() as Test>)` during codegen
  |
  = note: delayed at src/librustc_trait_selection/traits/codegen/mod.rs:65:32

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:369:17
stack backtrace:
   0:     0x7f5cd57ce3e0 - std::backtrace_rs::backtrace::libunwind::trace::hdf911925cfd1a062
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/../../backtrace/src/backtrace/libunwind.rs:96
   1:     0x7f5cd57ce3e0 - std::backtrace_rs::backtrace::trace_unsynchronized::h1a4f248df23e18fe
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/../../backtrace/src/backtrace/mod.rs:66
   2:     0x7f5cd57ce3e0 - std::sys_common::backtrace::_print_fmt::hf3ec23fc59b676bd
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/sys_common/backtrace.rs:79
   3:     0x7f5cd57ce3e0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h00fdb223b1b833ac
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/sys_common/backtrace.rs:58
   4:     0x7f5cd583ccfc - core::fmt::write::h1857a60b204f1b6a
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/core/src/fmt/mod.rs:1082
   5:     0x7f5cd57c0727 - std::io::Write::write_fmt::ha851958ed267cb97
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/io/mod.rs:1514
   6:     0x7f5cd57d30e0 - std::sys_common::backtrace::_print::hf25dbce5d8adc35c
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/sys_common/backtrace.rs:61
   7:     0x7f5cd57d30e0 - std::sys_common::backtrace::print::h40243408d050ccf7
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/sys_common/backtrace.rs:48
   8:     0x7f5cd57d30e0 - std::panicking::default_hook::{{closure}}::ha452abcc85cd3549
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/panicking.rs:208
   9:     0x7f5cd57d2e2c - std::panicking::default_hook::h637245b92cbb00b1
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/panicking.rs:227
  10:     0x7f5cd604cbf9 - rustc_driver::report_ice::h933e5e0b55de0282
  11:     0x7f5cd57d3888 - std::panicking::rust_panic_with_hook::h2f4c96dfd8ba524a
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/panicking.rs:581
  12:     0x7f5cd8fd0a74 - std::panicking::begin_panic::{{closure}}::h0480611fd3e85463
  13:     0x7f5cd8fd06fc - std::sys_common::backtrace::__rust_end_short_backtrace::h28ce56a124a681e8
  14:     0x7f5cd8fd0a4c - std::panicking::begin_panic::hf6cfa200080ff80e
  15:     0x7f5cd8f91f95 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h0ee29e29ce6ff70e
  16:     0x7f5cd608a276 - core::ptr::drop_in_place::hb42a0f663aaa0455
  17:     0x7f5cd6093eb6 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::hb78f65bd11bcc559
  18:     0x7f5cd600c58d - core::ptr::drop_in_place::h4f9d005f9e4526d4
  19:     0x7f5cd6003b36 - rustc_span::with_source_map::hd446b3bbf0747302
  20:     0x7f5cd6072373 - rustc_interface::interface::create_compiler_and_run::h76fdb9e44d576ca8
  21:     0x7f5cd605090a - scoped_tls::ScopedKey<T>::set::h89811fe665912abe
  22:     0x7f5cd6065527 - std::sys_common::backtrace::__rust_begin_short_backtrace::h7756fc79f059cbfa
  23:     0x7f5cd5feda5e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h1585549d089e37bf
  24:     0x7f5cd57e2e2a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hd50938a7cbd66861
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/alloc/src/boxed.rs:1042
  25:     0x7f5cd57e2e2a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hbdaa88962d74e8ba
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/alloc/src/boxed.rs:1042
  26:     0x7f5cd57e2e2a - std::sys::unix::thread::Thread::new::thread_start::h2e71bf448b68bc62
                               at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/sys/unix/thread.rs:87
  27:     0x7f5cd571e609 - start_thread
  28:     0x7f5cd5632103 - clone
  29:                0x0 - <unknown>

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.48.0-nightly (d006f5734 2020-08-28) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `playground`.
Backtrace

Standard Error

   Compiling playground v0.0.1 (/playground)

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorReported', src/librustc_mir/monomorphize/collector.rs:722:84
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/std/src/panicking.rs:483
   1: core::panicking::panic_fmt
             at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/core/src/panicking.rs:85
   2: core::option::expect_none_failed
             at /rustc/d006f5734f49625c34d6fc33bf6b9967243abca8/library/core/src/option.rs:1221
   3: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
   4: rustc_mir::monomorphize::collector::collect_neighbours
   5: rustc_mir::monomorphize::collector::collect_items_rec
   6: rustc_session::utils::<impl rustc_session::session::Session>::time
   7: rustc_mir::monomorphize::collector::collect_crate_mono_items
   8: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
   9: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
  10: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  11: rustc_data_structures::stack::ensure_sufficient_stack
  12: rustc_query_system::query::plumbing::get_query_impl
  13: rustc_codegen_ssa::base::codegen_crate
  14: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  15: rustc_interface::passes::QueryContext::enter
  16: rustc_interface::queries::Queries::ongoing_codegen
  17: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  18: rustc_span::with_source_map
  19: rustc_interface::interface::create_compiler_and_run
  20: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]`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.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions