<p dir="auto">Testcase:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]
#![crate_type=&quot;lib&quot;]

pub trait Test {
    type Node;
    type Iter: Iterator&lt;Item=Self::Node&gt;;
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>associated_types<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>crate_type=<span class="pl-s">"lib"</span><span class="pl-kos">]</span></span>

<span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">Test</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">Node</span><span class="pl-kos">;</span>
    <span class="pl-k">type</span> <span class="pl-smi">Iter</span><span class="pl-kos">:</span> <span class="pl-smi">Iterator</span><span class="pl-kos">&lt;</span><span class="pl-smi">Item</span>=<span class="pl-smi">Self</span><span class="pl-kos">::</span><span class="pl-smi">Node</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">ICE:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="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 'assertion failed: did.krate != ast::LOCAL_CRATE', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/ty.rs:5429

stack backtrace:
   1:     0x7fcf3fdbc2d0 - sys::backtrace::write::h8532e701ef86014f4it
   2:     0x7fcf3fde1b00 - failure::on_fail::h7532e1f79d134d5dzvz
   3:     0x7fcf3fd471c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz
   4:     0x7fcf3dd889e0 - rt::unwind::begin_unwind::h51822373508492588
   5:     0x7fcf3e1254a0 - middle::ty::lookup_trait_def::h03e4deaeef63a30dbJ8
   6:     0x7fcf3f42fa00 - astconv::trait_defines_associated_type_named::had5db55e34b01255d8r
   7:     0x7fcf3f43ecf0 - astconv::associated_path_def_to_ty::hc84b3dad34a6beb7y3r
   8:     0x7fcf3f510a70 - astconv::ast_ty_to_ty::unboxed_closure.36573
   9:     0x7fcf3f50ff00 - astconv::ast_ty_to_ty::h9742186571356203849
  10:     0x7fcf3f52cc20 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h3042184163872248324
  11:     0x7fcf3f53a500 - astconv::instantiate_poly_trait_ref::h5037713284232952206
  12:     0x7fcf3f53a2c0 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h16052932742123044349
  13:     0x7fcf3f5880b0 - collect::conv_param_bounds::h6119870663778270976
  14:     0x7fcf3f5b8760 - collect::ty_generics_for_trait::predicates_for_associated_types::unboxed_closure.38348
  15:     0x7fcf3f5b80c0 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h16559678602879155701
  16:     0x7fcf3f582dc0 - collect::ty_generics_for_trait::h3bec9bdd99c50c92L6t
  17:     0x7fcf3f4ed530 - collect::trait_def_of_item::h4615ec192a82cc79FSt
  18:     0x7fcf3f4eafc0 - collect::CollectTraitDefVisitor&lt;'a, 'tcx&gt;.visit..Visitor&lt;'v&gt;::visit_item::hdba3ee6263b30487m6s
  19:     0x7fcf3f5f1dd0 - check_crate::unboxed_closure.40065
  20:     0x7fcf3f5efc30 - check_crate::h19fb6dea5733566ajsx
  21:     0x7fcf4030d640 - driver::phase_3_run_analysis_passes::h46b1604d9f9f5633Tva
  22:     0x7fcf402fbae0 - driver::compile_input::h68b8602933aad8d7wba
  23:     0x7fcf403c6eb0 - thunk::F.Invoke&lt;A, R&gt;::invoke::h18029802347644288836
  24:     0x7fcf403c5c60 - rt::unwind::try::try_fn::h6518866316425934196
  25:     0x7fcf3fe48400 - rust_try_inner
  26:     0x7fcf3fe483f0 - rust_try
  27:     0x7fcf403c5fb0 - thunk::F.Invoke&lt;A, R&gt;::invoke::h15513809553472565307
  28:     0x7fcf3fdcde40 - sys::thread::thread_start::h5ea7ba97235331d5a9v
  29:     0x7fcf3a439fe0 - start_thread
  30:     0x7fcf3f9f5c99 - __clone
  31:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">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 'assertion failed: did.krate != ast::LOCAL_CRATE', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/librustc/middle/ty.rs:5429

stack backtrace:
   1:     0x7fcf3fdbc2d0 - sys::backtrace::write::h8532e701ef86014f4it
   2:     0x7fcf3fde1b00 - failure::on_fail::h7532e1f79d134d5dzvz
   3:     0x7fcf3fd471c0 - rt::unwind::begin_unwind_inner::h97b151606151d62deaz
   4:     0x7fcf3dd889e0 - rt::unwind::begin_unwind::h51822373508492588
   5:     0x7fcf3e1254a0 - middle::ty::lookup_trait_def::h03e4deaeef63a30dbJ8
   6:     0x7fcf3f42fa00 - astconv::trait_defines_associated_type_named::had5db55e34b01255d8r
   7:     0x7fcf3f43ecf0 - astconv::associated_path_def_to_ty::hc84b3dad34a6beb7y3r
   8:     0x7fcf3f510a70 - astconv::ast_ty_to_ty::unboxed_closure.36573
   9:     0x7fcf3f50ff00 - astconv::ast_ty_to_ty::h9742186571356203849
  10:     0x7fcf3f52cc20 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h3042184163872248324
  11:     0x7fcf3f53a500 - astconv::instantiate_poly_trait_ref::h5037713284232952206
  12:     0x7fcf3f53a2c0 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h16052932742123044349
  13:     0x7fcf3f5880b0 - collect::conv_param_bounds::h6119870663778270976
  14:     0x7fcf3f5b8760 - collect::ty_generics_for_trait::predicates_for_associated_types::unboxed_closure.38348
  15:     0x7fcf3f5b80c0 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h16559678602879155701
  16:     0x7fcf3f582dc0 - collect::ty_generics_for_trait::h3bec9bdd99c50c92L6t
  17:     0x7fcf3f4ed530 - collect::trait_def_of_item::h4615ec192a82cc79FSt
  18:     0x7fcf3f4eafc0 - collect::CollectTraitDefVisitor&lt;'a, 'tcx&gt;.visit..Visitor&lt;'v&gt;::visit_item::hdba3ee6263b30487m6s
  19:     0x7fcf3f5f1dd0 - check_crate::unboxed_closure.40065
  20:     0x7fcf3f5efc30 - check_crate::h19fb6dea5733566ajsx
  21:     0x7fcf4030d640 - driver::phase_3_run_analysis_passes::h46b1604d9f9f5633Tva
  22:     0x7fcf402fbae0 - driver::compile_input::h68b8602933aad8d7wba
  23:     0x7fcf403c6eb0 - thunk::F.Invoke&lt;A, R&gt;::invoke::h18029802347644288836
  24:     0x7fcf403c5c60 - rt::unwind::try::try_fn::h6518866316425934196
  25:     0x7fcf3fe48400 - rust_try_inner
  26:     0x7fcf3fe483f0 - rust_try
  27:     0x7fcf403c5fb0 - thunk::F.Invoke&lt;A, R&gt;::invoke::h15513809553472565307
  28:     0x7fcf3fdcde40 - sys::thread::thread_start::h5ea7ba97235331d5a9v
  29:     0x7fcf3a439fe0 - start_thread
  30:     0x7fcf3f9f5c99 - __clone
  31:                0x0 - &lt;unknown&gt;
</code></pre></div>
<p dir="auto">rustc version:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rustc 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000)
binary: rustc
commit-hash: c6c786671d692d7b13c2e5c68a53001327b4b125
commit-date: 2015-01-04 00:50:59 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightl"><pre class="notranslate"><code class="notranslate">rustc 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000)
binary: rustc
commit-hash: c6c786671d692d7b13c2e5c68a53001327b4b125
commit-date: 2015-01-04 00:50:59 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightl
</code></pre></div>
<p dir="auto">It actually happens even if you take out the <code class="notranslate">type T</code> but I figured that would be too confusing of a testcase.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]

pub trait Foo {
    type T;
    type S: Bar&lt;Self::T&gt;;
}

pub trait Bar&lt;T&gt; {}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>associated_types<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">T</span><span class="pl-kos">;</span>
    <span class="pl-k">type</span> <span class="pl-smi">S</span><span class="pl-kos">:</span> <span class="pl-smi">Bar</span><span class="pl-kos">&lt;</span><span class="pl-smi">Self</span><span class="pl-kos">::</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">Bar</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<div class="highlight highlight-text-shell-session notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="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', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/option.rs:329

stack backtrace:
   1:        0x1078c7c38 - sys::backtrace::write::h329291c3ffa2342c0Jt
   2:        0x1078e8a03 - failure::on_fail::h17e4ace9633d727be0z
   3:        0x107854c3a - rt::unwind::begin_unwind_inner::h190be063817ae06eFHz
   4:        0x10785915d - rt::unwind::begin_unwind_fmt::hc68ebd2b3de4118e2Ez
   5:        0x1078e8302 - rust_begin_unwind
   6:        0x107935d0c - panicking::panic_fmt::h6d9a452b0d084e9dLkl
   7:        0x1046960b9 - collections::hash::map::HashMap&lt;K,$u{20}V$C$$u{20}H$GT$.Index$LT$Q$C$$u{20}V$GT$::index::h4548773097338651390
   8:        0x104756a96 - astconv::ast_ty_to_ty::unboxed_closure.36753
   9:        0x104755323 - astconv::ast_ty_to_ty::h3464216238889989760
  10:        0x10475497c - iter::IteratorExt::collect::h1178474147849539242
  11:        0x104862cf1 - astconv::ast_path_to_trait_ref::h12290017992957141453
  12:        0x1048625e6 - astconv::instantiate_poly_trait_ref::h3434886886043991751
  13:        0x104862350 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h6759705047736047902
  14:        0x1048c987d - collect::compute_bounds::h9074989142750734463
  15:        0x104860e9b - collect::ty_generics_for_trait::ha23d00f7844cb7b4quv
  16:        0x1047321ee - collect::trait_def_of_item::h2e00c54b47ce1f2cgdv
  17:        0x10472ed30 - collect::CollectTraitDefVisitor&lt;$u{27}a$C$$u{20}$u{27}tcx$GT$.visit..Visitor$LT$$u{27}v$GT$::visit_item::h913166666a1bcfc7dSt
  18:        0x10492237f - check_crate::unboxed_closure.43401
  19:        0x10492048a - check_crate::hcab218417b8f1f7f51y
  20:        0x103ff9113 - driver::phase_3_run_analysis_passes::hb0ac12e829cd00e7Jta
  21:        0x103fdaffe - driver::compile_input::hdcb29128a43ec322wba
  22:        0x10417aff8 - thunk::Thunk&lt;(*,$u{20}R$GT$::new::unboxed_closure.30336
  23:        0x104179038 - thunk::F.Invoke&lt;A,$u{20}R$GT$::invoke::h12480167585331118411
  24:        0x1041777d9 - rt::unwind::try::try_fn::h9666833473335668351
  25:        0x107950669 - rust_try_inner
  26:        0x107950656 - rust_try
  27:        0x104177ed7 - thunk::F.Invoke&lt;A,$u{20}R$GT$::invoke::h4838524648863172491
  28:        0x1078d7c24 - sys::thread::thread_start::h7394d69fbc5b85e9vFw
  29:     0x7fff8115e899 - _pthread_body
  30:     0x7fff8115e72a - _pthread_struct_init"><pre class="notranslate"><span class="pl-c1">error: internal compiler error: unexpected panic</span>
<span class="pl-c1">note: the compiler unexpectedly panicked. this is a bug.</span>
<span class="pl-c1">note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html</span>
<span class="pl-c1">note: run with `RUST_BACKTRACE=1` for a backtrace</span>
<span class="pl-c1">thread 'rustc' panicked at 'no entry found for key', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/option.rs:329</span>

<span class="pl-c1">stack backtrace:</span>
<span class="pl-c1">   1:        0x1078c7c38 - sys::backtrace::write::h329291c3ffa2342c0Jt</span>
<span class="pl-c1">   2:        0x1078e8a03 - failure::on_fail::h17e4ace9633d727be0z</span>
<span class="pl-c1">   3:        0x107854c3a - rt::unwind::begin_unwind_inner::h190be063817ae06eFHz</span>
<span class="pl-c1">   4:        0x10785915d - rt::unwind::begin_unwind_fmt::hc68ebd2b3de4118e2Ez</span>
<span class="pl-c1">   5:        0x1078e8302 - rust_begin_unwind</span>
<span class="pl-c1">   6:        0x107935d0c - panicking::panic_fmt::h6d9a452b0d084e9dLkl</span>
<span class="pl-c1">   7:        0x1046960b9 - collections::hash::map::HashMap&lt;K,$u{20}V$C$$u{20}H$GT$.Index$LT$Q$C$$u{20}V$GT$::index::h4548773097338651390</span>
<span class="pl-c1">   8:        0x104756a96 - astconv::ast_ty_to_ty::unboxed_closure.36753</span>
<span class="pl-c1">   9:        0x104755323 - astconv::ast_ty_to_ty::h3464216238889989760</span>
<span class="pl-c1">  10:        0x10475497c - iter::IteratorExt::collect::h1178474147849539242</span>
<span class="pl-c1">  11:        0x104862cf1 - astconv::ast_path_to_trait_ref::h12290017992957141453</span>
<span class="pl-c1">  12:        0x1048625e6 - astconv::instantiate_poly_trait_ref::h3434886886043991751</span>
<span class="pl-c1">  13:        0x104862350 - vec::Vec&lt;T&gt;.FromIterator&lt;T&gt;::from_iter::h6759705047736047902</span>
<span class="pl-c1">  14:        0x1048c987d - collect::compute_bounds::h9074989142750734463</span>
<span class="pl-c1">  15:        0x104860e9b - collect::ty_generics_for_trait::ha23d00f7844cb7b4quv</span>
<span class="pl-c1">  16:        0x1047321ee - collect::trait_def_of_item::h2e00c54b47ce1f2cgdv</span>
<span class="pl-c1">  17:        0x10472ed30 - collect::CollectTraitDefVisitor&lt;$u{27}a$C$$u{20}$u{27}tcx$GT$.visit..Visitor$LT$$u{27}v$GT$::visit_item::h913166666a1bcfc7dSt</span>
<span class="pl-c1">  18:        0x10492237f - check_crate::unboxed_closure.43401</span>
<span class="pl-c1">  19:        0x10492048a - check_crate::hcab218417b8f1f7f51y</span>
<span class="pl-c1">  20:        0x103ff9113 - driver::phase_3_run_analysis_passes::hb0ac12e829cd00e7Jta</span>
<span class="pl-c1">  21:        0x103fdaffe - driver::compile_input::hdcb29128a43ec322wba</span>
<span class="pl-c1">  22:        0x10417aff8 - thunk::Thunk&lt;(*,$u{20}R$GT$::new::unboxed_closure.30336</span>
<span class="pl-c1">  23:        0x104179038 - thunk::F.Invoke&lt;A,$u{20}R$GT$::invoke::h12480167585331118411</span>
<span class="pl-c1">  24:        0x1041777d9 - rt::unwind::try::try_fn::h9666833473335668351</span>
<span class="pl-c1">  25:        0x107950669 - rust_try_inner</span>
<span class="pl-c1">  26:        0x107950656 - rust_try</span>
<span class="pl-c1">  27:        0x104177ed7 - thunk::F.Invoke&lt;A,$u{20}R$GT$::invoke::h4838524648863172491</span>
<span class="pl-c1">  28:        0x1078d7c24 - sys::thread::thread_start::h7394d69fbc5b85e9vFw</span>
<span class="pl-c1">  29:     0x7fff8115e899 - _pthread_body</span>
<span class="pl-c1">  30:     0x7fff8115e72a - _pthread_struct_init</span></pre></div>