Skip to content

Requiring an associated type to equal another associated type in short form causes ICE #21177

Closed
@chris-morgan

Description

@chris-morgan
trait Trait {
    type A;
    type B;
}

fn foo<T: Trait<A = T::B>>() { }

fn main() { }
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'no entry found for key', /home/chris/rust/src/libcore/option.rs:330

stack backtrace:
   1:     0x7f1bdaa67bf0 - sys::backtrace::write::h7b4652da93e0a6048Rt
   2:     0x7f1bdaa895d0 - failure::on_fail::h2a6984dfe8e1b221S5z
   3:     0x7f1bda9f84d0 - rt::unwind::begin_unwind_inner::hbfa34a31f6bc957fKKz
   4:     0x7f1bda9f9000 - rt::unwind::begin_unwind_fmt::h6c7c8c5b6dc8e9b9hJz
   5:     0x7f1bdaa89430 - rust_begin_unwind
   6:     0x7f1bdaadacf0 - panicking::panic_fmt::h11291b5a282b76fevym
   7:     0x7f1bda29b530 - astconv::ast_ty_to_ty::unboxed_closure.29407
   8:     0x7f1bda24dad0 - astconv::ast_ty_to_ty::h64e2d9fd465a2c80zSs
   9:     0x7f1bda2941a0 - vec::Vec<T>.FromIterator<T>::from_iter::h13674382761369726296
  10:     0x7f1bda2920d0 - astconv::convert_angle_bracketed_parameters::hfa481a73e832cf6dR4r
  11:     0x7f1bda296420 - astconv::ast_path_to_trait_ref::h9001035b31308841ofs
  12:     0x7f1bda295350 - astconv::instantiate_trait_ref::h9401a0da7f536e00ids
  13:     0x7f1bda294ee0 - astconv::instantiate_poly_trait_ref::h933f0a2588ce9f9a7bs
  14:     0x7f1bda2c5710 - collect::compute_bounds::hb52b1931fefb8daaL8u
  15:     0x7f1bda2c7920 - collect::ty_generics::hee8e6e7029ef26ae3Vu
  16:     0x7f1bda2c3030 - collect::ty_generics_for_fn_or_method::h2a9394f774b1cb1aGSu
  17:     0x7f1bda2b98f0 - collect::ty_of_item::ha8c8010c66ca46a38Bu
  18:     0x7f1bda2b2880 - collect::convert::hadcbcd14f2be1533oeu
  19:     0x7f1bda2f7070 - check_crate::unboxed_closure.30640
  20:     0x7f1bda2f50b0 - check_crate::h401329d2b807aaabney
  21:     0x7f1bdafc1c20 - driver::phase_3_run_analysis_passes::ha0279b98663a6ec7EEa
  22:     0x7f1bdafafa00 - driver::compile_input::habc7e9a404c53712Aba
  23:     0x7f1bdb071420 - run_compiler::h21eb51f8a0ee17ece5b
  24:     0x7f1bdb06fb90 - thunk::F.Invoke<A, R>::invoke::h9539250436629313017
  25:     0x7f1bdb06eaf0 - rt::unwind::try::try_fn::h11124252207944909230
  26:     0x7f1bdaaf92a0 - rust_try_inner
  27:     0x7f1bdaaf9290 - rust_try
  28:     0x7f1bdb06eda0 - thunk::F.Invoke<A, R>::invoke::h11373657575374727143
  29:     0x7f1bdaa77270 - sys::thread::thread_start::h4220cbfce5fdbe98VJw
  30:     0x7f1bd51b1250 - start_thread
  31:     0x7f1bda6a8219 - clone
  32:                0x0 - <unknown>

Note that <T: Trait<A = <T as Trait>::B>> works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions