<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]

impl Foo for int {
    type A = uint;
}

pub trait Foo {
    type A;
}

pub fn main() {}"><pre class="notranslate"><code class="notranslate">#![feature(associated_types)]

impl Foo for int {
    type A = uint;
}

pub trait Foo {
    type A;
}

pub fn main() {}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="task 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 13 } in tcx.impl_or_trait_items', /home/ncameron/rust/src/librustc/middle/ty.rs:4310

stack backtrace:
   1:     0x7f1940943440 - rt::backtrace::imp::write::h0f67e562de667d35Gay
   2:     0x7f19409478b0 - failure::on_fail::h58a0ff7a5099a6000Cy
   3:     0x7f19405fec80 - unwind::begin_unwind_inner::ha57e93b5d4f1f80d1Qc
   4:     0x7f19405fe7e0 - unwind::begin_unwind_fmt::ha9fc4b78efd146fccOc
   5:     0x7f193f4ead30 - middle::ty::impl_or_trait_item::h55c274f1e1ee9b78Xl8
   6:     0x7f193f95cc40 - middle::typeck::collect::ImplCtxt&lt;'a, 'tcx&gt;.AstConv&lt;'tcx&gt;::associated_type_binding::hcc097ca1cd60b433DCK
   7:     0x7f193f994750 - middle::typeck::astconv::create_substs_for_ast_path::h12687352172379627279
   8:     0x7f193f87e830 - middle::typeck::collect::convert::h51f7fcfe7a681561cXK
   9:     0x7f193f878890 - middle::typeck::collect::collect_item_types::hf182a64ac9f0ea5eORJ
  10:     0x7f193f751d10 - util::common::time::h13554638601947919603
  11:     0x7f193f751310 - middle::typeck::check_crate::h9b48aa6c28528690bQP
  12:     0x7f1940f43120 - driver::driver::phase_3_run_analysis_passes::h938db519a111a7574nS
  13:     0x7f1940f3c410 - driver::driver::compile_input::h282769b6ecf9b18b44R
  14:     0x7f1940fb9260 - driver::run::closure.61472
  15:     0x7f1940fc6290 - task::TaskBuilder::try_future::closure.62104
  16:     0x7f194093a910 - task::TaskBuilder::spawn_internal::closure.31177
  17:     0x7f1940600b90 - task::Task::spawn::closure.5779
  18:     0x7f194065b090 - rust_try_inner
  19:     0x7f194065b080 - rust_try
  20:     0x7f19405fe540 - unwind::try::heee2f446c60ea967mFc
  21:     0x7f1940600a40 - task::Task::run::h7f1d4c2e55b46abdeOb
  22:     0x7f1940600810 - task::Task::spawn::closure.5755
  23:     0x7f1940604350 - thread::thread_start::hc7adf40c9d3bfc57h6b
  24:     0x7f193b83a0c0 - start_thread
  25:     0x7f19402bef89 - __clone
  26:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">task 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 13 } in tcx.impl_or_trait_items', /home/ncameron/rust/src/librustc/middle/ty.rs:4310

stack backtrace:
   1:     0x7f1940943440 - rt::backtrace::imp::write::h0f67e562de667d35Gay
   2:     0x7f19409478b0 - failure::on_fail::h58a0ff7a5099a6000Cy
   3:     0x7f19405fec80 - unwind::begin_unwind_inner::ha57e93b5d4f1f80d1Qc
   4:     0x7f19405fe7e0 - unwind::begin_unwind_fmt::ha9fc4b78efd146fccOc
   5:     0x7f193f4ead30 - middle::ty::impl_or_trait_item::h55c274f1e1ee9b78Xl8
   6:     0x7f193f95cc40 - middle::typeck::collect::ImplCtxt&lt;'a, 'tcx&gt;.AstConv&lt;'tcx&gt;::associated_type_binding::hcc097ca1cd60b433DCK
   7:     0x7f193f994750 - middle::typeck::astconv::create_substs_for_ast_path::h12687352172379627279
   8:     0x7f193f87e830 - middle::typeck::collect::convert::h51f7fcfe7a681561cXK
   9:     0x7f193f878890 - middle::typeck::collect::collect_item_types::hf182a64ac9f0ea5eORJ
  10:     0x7f193f751d10 - util::common::time::h13554638601947919603
  11:     0x7f193f751310 - middle::typeck::check_crate::h9b48aa6c28528690bQP
  12:     0x7f1940f43120 - driver::driver::phase_3_run_analysis_passes::h938db519a111a7574nS
  13:     0x7f1940f3c410 - driver::driver::compile_input::h282769b6ecf9b18b44R
  14:     0x7f1940fb9260 - driver::run::closure.61472
  15:     0x7f1940fc6290 - task::TaskBuilder::try_future::closure.62104
  16:     0x7f194093a910 - task::TaskBuilder::spawn_internal::closure.31177
  17:     0x7f1940600b90 - task::Task::spawn::closure.5779
  18:     0x7f194065b090 - rust_try_inner
  19:     0x7f194065b080 - rust_try
  20:     0x7f19405fe540 - unwind::try::heee2f446c60ea967mFc
  21:     0x7f1940600a40 - task::Task::run::h7f1d4c2e55b46abdeOb
  22:     0x7f1940600810 - task::Task::spawn::closure.5755
  23:     0x7f1940604350 - thread::thread_start::hc7adf40c9d3bfc57h6b
  24:     0x7f193b83a0c0 - start_thread
  25:     0x7f19402bef89 - __clone
  26:                0x0 - &lt;unknown&gt;
</code></pre></div>
<p dir="auto">Not sure how to properly describe the bug, but this causes an ICE:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]

struct SimulationInfo;

impl SimulationInfo {
    fn add_state&lt;T: HasState&gt;(&amp;mut self, op: || -&gt; &lt;T as HasState&gt;::State)
        -&gt; Option&lt;&amp;mut &lt;T as HasState&gt;::State&gt; {
        None
    }
}

trait HasState {
    type State;
}"><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">struct</span> <span class="pl-smi">SimulationInfo</span><span class="pl-kos">;</span>

<span class="pl-k">impl</span> <span class="pl-smi">SimulationInfo</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">add_state</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">:</span> <span class="pl-smi">HasState</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">,</span> <span class="pl-s1">op</span><span class="pl-kos">:</span> || -&gt; &lt;<span class="pl-smi">T</span> <span class="pl-k">as</span> <span class="pl-smi">HasState</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">State</span><span class="pl-kos">)</span>
        -&gt; <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> &lt;<span class="pl-smi">T</span> <span class="pl-k">as</span> <span class="pl-smi">HasState</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">State</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-v">None</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">trait</span> <span class="pl-smi">HasState</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">State</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Whereas this compiles:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]

struct SimulationInfo;

trait HasState {
    type State;
}

impl SimulationInfo {
    fn add_state&lt;T: HasState&gt;(&amp;mut self, op: || -&gt; &lt;T as HasState&gt;::State)
        -&gt; Option&lt;&amp;mut &lt;T as HasState&gt;::State&gt; {
        None
    }
}"><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">struct</span> <span class="pl-smi">SimulationInfo</span><span class="pl-kos">;</span>

<span class="pl-k">trait</span> <span class="pl-smi">HasState</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">State</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">SimulationInfo</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">add_state</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">:</span> <span class="pl-smi">HasState</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">,</span> <span class="pl-s1">op</span><span class="pl-kos">:</span> || -&gt; &lt;<span class="pl-smi">T</span> <span class="pl-k">as</span> <span class="pl-smi">HasState</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">State</span><span class="pl-kos">)</span>
        -&gt; <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> &lt;<span class="pl-smi">T</span> <span class="pl-k">as</span> <span class="pl-smi">HasState</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">State</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-v">None</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Failure:</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
task 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 33 } in tcx.impl_or_trait_items', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/ty.rs:4066

stack backtrace:
   1:        0x10d45a619 - rt::backtrace::imp::write::h03fee16d4a0b6b41moq
   2:        0x10d45d85c - failure::on_fail::h3e0f6b3c6c4bbcc3VEq
   3:        0x10d6bcf05 - unwind::begin_unwind_inner::h6c7f4532e72658d7SJd
   4:        0x10d6bcb9f - unwind::begin_unwind_fmt::h9863b25c438d6314kHd
   5:        0x10a408d50 - middle::ty::impl_or_trait_item::h8676078de6338b03J2J
   6:        0x10a7fe51e - middle::typeck::collect::convert_methods::ty_of_method::h1b65fc29f839dd39kEi
   7:        0x10a7a4b84 - middle::typeck::collect::convert::hf5d19782a9342fbfL7i
   8:        0x10a79c993 - middle::typeck::collect::collect_item_types::h2af040048993f98298h
   9:        0x10a1bb556 - util::common::time::h11920059333862041717
  10:        0x10a965478 - middle::typeck::check_crate::h50fcc5c8b39993f4LVn
  11:        0x10a9cdbcf - driver::driver::phase_3_run_analysis_passes::h1425a4ca465c7b097DA
  12:        0x10a9c82b8 - driver::driver::compile_input::h60bc42ef7fabbfd4SkA
  13:        0x10aa45ca8 - driver::run_compiler::h4031243f49082a9fw7D
  14:        0x10aa43ece - driver::run::closure.145349
  15:        0x10a1d381b - task::TaskBuilder&lt;S&gt;::try_future::closure.103709
  16:        0x10a1d3713 - task::TaskBuilder&lt;S&gt;::spawn_internal::closure.103680
  17:        0x10a15398d - task::NativeSpawner.Spawner::spawn::closure.8526
  18:        0x10d72320c - rust_try_inner
  19:        0x10d7231f6 - rust_try
  20:        0x10d6ba677 - unwind::try::hab84862d0081b274cyd
  21:        0x10d6ba50c - task::Task::run::h39093ecd59554b49ZJc
  22:        0x10a1537b3 - task::NativeSpawner.Spawner::spawn::closure.8463
  23:        0x10d6bbd37 - thread::thread_start::h589be8c0a398d299e5c
  24:     0x7fff9260c2fc - _pthread_body
  25:     0x7fff9260c279 - _pthread_body"><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
task 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 33 } in tcx.impl_or_trait_items', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/ty.rs:4066

stack backtrace:
   1:        0x10d45a619 - rt::backtrace::imp::write::h03fee16d4a0b6b41moq
   2:        0x10d45d85c - failure::on_fail::h3e0f6b3c6c4bbcc3VEq
   3:        0x10d6bcf05 - unwind::begin_unwind_inner::h6c7f4532e72658d7SJd
   4:        0x10d6bcb9f - unwind::begin_unwind_fmt::h9863b25c438d6314kHd
   5:        0x10a408d50 - middle::ty::impl_or_trait_item::h8676078de6338b03J2J
   6:        0x10a7fe51e - middle::typeck::collect::convert_methods::ty_of_method::h1b65fc29f839dd39kEi
   7:        0x10a7a4b84 - middle::typeck::collect::convert::hf5d19782a9342fbfL7i
   8:        0x10a79c993 - middle::typeck::collect::collect_item_types::h2af040048993f98298h
   9:        0x10a1bb556 - util::common::time::h11920059333862041717
  10:        0x10a965478 - middle::typeck::check_crate::h50fcc5c8b39993f4LVn
  11:        0x10a9cdbcf - driver::driver::phase_3_run_analysis_passes::h1425a4ca465c7b097DA
  12:        0x10a9c82b8 - driver::driver::compile_input::h60bc42ef7fabbfd4SkA
  13:        0x10aa45ca8 - driver::run_compiler::h4031243f49082a9fw7D
  14:        0x10aa43ece - driver::run::closure.145349
  15:        0x10a1d381b - task::TaskBuilder&lt;S&gt;::try_future::closure.103709
  16:        0x10a1d3713 - task::TaskBuilder&lt;S&gt;::spawn_internal::closure.103680
  17:        0x10a15398d - task::NativeSpawner.Spawner::spawn::closure.8526
  18:        0x10d72320c - rust_try_inner
  19:        0x10d7231f6 - rust_try
  20:        0x10d6ba677 - unwind::try::hab84862d0081b274cyd
  21:        0x10d6ba50c - task::Task::run::h39093ecd59554b49ZJc
  22:        0x10a1537b3 - task::NativeSpawner.Spawner::spawn::closure.8463
  23:        0x10d6bbd37 - thread::thread_start::h589be8c0a398d299e5c
  24:     0x7fff9260c2fc - _pthread_body
  25:     0x7fff9260c279 - _pthread_body
</code></pre></div>