Skip to content

ICE: this associated type didn't get added as a parameter for some reason #19883

Closed
@japaric

Description

@japaric

STR

#![crate_type = "lib"]
#![feature(associated_types)]

trait From<Src> {
    type Output;

    fn from(src: Src) -> <Self as From<Src>>::Output;
}

trait To {
    // There is a typo, the return type should be `<Dst as From<Self>>::Output`
    // But this should be a normal compiler error not an ICE
    fn to<Dst: From<Self>>(self) -> <Dst as From<Self>>::Dst {
        From::from(self)
    }
}

Output

19883.rs:11:37: 11:61 error: internal compiler error: this associated type didn't get added as a parameter for some reason
19883.rs:11     fn to<Dst: From<Self>>(self) -> <Dst as From<Self>>::Dst {
                                                ^~~~~~~~~~~~~~~~~~~~~~~~
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
task 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:129

stack backtrace:
   1:     0x7f083f342ce0 - rt::backtrace::imp::write::h237d5d896ed0f40efVx
   2:     0x7f083f3460b0 - failure::on_fail::h3b97f678965193b4Imy
   3:     0x7f083ef86d30 - unwind::begin_unwind_inner::hc3725627c2d5c417zNc
   4:     0x7f083c6a20e0 - unwind::begin_unwind::h8279683110198018234
   5:     0x7f083c6a2060 - diagnostic::SpanHandler::span_bug::hf2268a54b53be12enBF
   6:     0x7f083d1cff30 - session::Session::span_bug::haf9c3121b033a12f8Kt
   7:     0x7f083e7167e0 - astconv::ast_ty_to_ty::unboxed_closure.37666
   8:     0x7f083e756a60 - astconv::convert_ty_with_lifetime_elision::h12513294479781701551
   9:     0x7f083e722ea0 - collect::convert_methods::ty_of_method::h79d0fe3ec3956e0b3gu
  10:     0x7f083e680ff0 - collect::convert::h40a9af5579711231OMu
  11:     0x7f083e842110 - check_crate::unboxed_closure.42655
  12:     0x7f083e8403e0 - check_crate::h5c4530b9564f36bc2Wy
  13:     0x7f083f796710 - driver::phase_3_run_analysis_passes::h9b04396b12417cc6Eta
  14:     0x7f083f779b30 - driver::compile_input::he1f39667f1a7a4ffrba
  15:     0x7f083f92d9d0 - run_compiler::hf27245cb04d8c7bdAYb
  16:     0x7f083f924610 - thunk::F.Invoke<A, R>::invoke::h4104191433293390625
  17:     0x7f083f31b090 - thunk::F.Invoke<A, R>::invoke::h5120075343862143221
  18:     0x7f083ef854a0 - task::Task::spawn_thunk::closure.5776
  19:     0x7f083efe3dd0 - rust_try_inner
  20:     0x7f083efe3dc0 - rust_try
  21:     0x7f083ef855b0 - unwind::try::h33b049793d5a9f6cQCc
  22:     0x7f083ef85340 - task::Task::run::ha83bf631ae8281faRNb
  23:     0x7f083ef84ab0 - thunk::F.Invoke<A, R>::invoke::h14235690088802735706
  24:     0x7f083ef86400 - thread::thread_start::hbe456cc4ba46eaeeb5b
  25:     0x7f0839b09250 - start_thread
  26:     0x7f083ec5a589 - clone
  27:                0x0 - <unknown>

Version

rustc 0.13.0-nightly (126db549b 2014-12-15 00:07:35 +0000)

cc @nikomatsakis @nick29581

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions