<ul dir="auto">
<li>I tried this code:</li>
</ul>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Stringify {
    fn to_string(&amp;self) -&gt; String;
}

impl Stringify for u32 {
    fn to_string(&amp;self) -&gt; String { format!(&quot;u32: {}&quot;, *self) }
}

impl Stringify for f32 {
    fn to_string(&amp;self) -&gt; String { format!(&quot;f32: {}&quot;, *self) }
}

fn print&lt;T: Stringify&gt;(x: T) {
    println!(&quot;{}&quot;, x.to_string());
}

fn main() {
    print(5);
    print(5.0);
}"><pre class="notranslate"><span class="pl-k">trait</span> <span class="pl-smi">Stringify</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">to_string</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">String</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Stringify</span> <span class="pl-k">for</span> <span class="pl-smi">u32</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">to_string</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">String</span> <span class="pl-kos">{</span> <span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"u32: {}"</span>, *<span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span> <span class="pl-smi">Stringify</span> <span class="pl-k">for</span> <span class="pl-smi">f32</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">to_string</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">String</span> <span class="pl-kos">{</span> <span class="pl-en">format</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"f32: {}"</span>, *<span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">print</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">:</span> <span class="pl-smi">Stringify</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">:</span> <span class="pl-smi">T</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"{}"</span>, x.to_string<span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-c1">5</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">print</span><span class="pl-kos">(</span><span class="pl-c1">5.0</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<ul dir="auto">
<li>I expected to see this happen:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="u32: 5
f32: 5.0"><pre class="notranslate"><code class="notranslate">u32: 5
f32: 5.0
</code></pre></div>
<ul dir="auto">
<li>Instead, this happened:</li>
</ul>
<p dir="auto">error: internal compiler error: Impl DefId { krate: 0, node: 12 }:u32.Stringify was matchable against Obligation(predicate=Binder(TraitPredicate(Stringify)),depth=0) but now is not<br>
note: the compiler unexpectedly panicked. this is a bug.<br>
note: we would appreciate a bug report: <a href="https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports">https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports</a><br>
note: run with <code class="notranslate">RUST_BACKTRACE=1</code> for a backtrace</p>
<h2 dir="auto">Meta</h2>
<p dir="auto">rustc 1.0.0-nightly (<a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/199bdcfeff5cfafd1f8e8ff583d7209272469879/hovercard" href="https://github.com/rust-lang/rust/commit/199bdcfeff5cfafd1f8e8ff583d7209272469879"><tt>199bdcf</tt></a> 2015-03-26) (built 2015-03-26)<br>
binary: rustc<br>
commit-hash: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/199bdcfeff5cfafd1f8e8ff583d7209272469879/hovercard" href="https://github.com/rust-lang/rust/commit/199bdcfeff5cfafd1f8e8ff583d7209272469879"><tt>199bdcf</tt></a><br>
commit-date: 2015-03-26<br>
build-date: 2015-03-26<br>
host: x86_64-apple-darwin<br>
release: 1.0.0-nightly</p>
<ul dir="auto">
<li>Backtrace:</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="thread 'rustc' panicked at 'Box&lt;Any&gt;', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:190

stack backtrace:
   1:        0x10cdac8b4 - sys::backtrace::write::h56b628caa3d9f4e2WBD
   2:        0x10cdd7a08 - panicking::on_panic::ha7bc09956d9f12916rJ
   3:        0x10ccf499e - rt::unwind::begin_unwind_inner::h5ef900798574fe5egaJ
   4:        0x10c4ec45e - rt::unwind::begin_unwind::h2748891250859470333
   5:        0x10c4ecc89 - diagnostic::Handler::bug::h57426bf76a5037d4pgB
   6:        0x10a06b4bf - middle::traits::select::SelectionContext&lt;'cx, 'tcx&gt;::rematch_impl::h3b4e834c3872ae21NVR
   7:        0x10a06ab56 - middle::infer::InferCtxt&lt;'a, 'tcx&gt;::try::h6881848181392734290
   8:        0x10a0510c4 - middle::traits::select::SelectionContext&lt;'cx, 'tcx&gt;::confirm_candidate::ha7bb241f7d3cdb480iR
   9:        0x10a025b8d - middle::traits::select::SelectionContext&lt;'cx, 'tcx&gt;::select::hb97262a482e0a260koP
  10:        0x10a0225e0 - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::select::hcffa8f4e81b26cc8HhN
  11:        0x10a021aee - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::select_where_possible::h0a2ed0d6733c5352VgN
  12:        0x10942d473 - check::vtable::select_fcx_obligations_where_possible::h796cff45179b9501A4b
  13:        0x10942cfc3 - check::vtable::select_all_fcx_obligations_and_apply_defaults::hfadb66c912bf39a2X0b
  14:        0x1094de47e - check::check_bare_fn::heb3c8094aebf74083nn
  15:        0x1094d68eb - check::check_item::h25c21617996c325dOGn
  16:        0x1095afed6 - check_crate::closure.35998
  17:        0x1095aad9a - check_crate::haa845b167eb64ccfOmC
  18:        0x1092e4477 - driver::phase_3_run_analysis_passes::h8f332883f9aa5c0arGa
  19:        0x1092ca4b7 - driver::compile_input::h0311d7070ac04983Rba
  20:        0x109384093 - run_compiler::hbe451b463527cb69s2b
  21:        0x109381bb5 - thunk::F.Invoke&lt;A, R&gt;::invoke::h777505636365567823
  22:        0x109380f77 - rt::unwind::try::try_fn::h5237749675862334843
  23:        0x10ce5dfa8 - rust_try_inner
  24:        0x10ce5df95 - rust_try
  25:        0x109381315 - thunk::F.Invoke&lt;A, R&gt;::invoke::h424791141543398798
  26:        0x10cdc299d - sys::thread::create::thread_start::h760927331a49c0e267H
  27:     0x7fff91d6b267 - _pthread_body
  28:     0x7fff91d6b1e4 - _pthread_start"><pre class="notranslate"><code class="notranslate">thread 'rustc' panicked at 'Box&lt;Any&gt;', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:190

stack backtrace:
   1:        0x10cdac8b4 - sys::backtrace::write::h56b628caa3d9f4e2WBD
   2:        0x10cdd7a08 - panicking::on_panic::ha7bc09956d9f12916rJ
   3:        0x10ccf499e - rt::unwind::begin_unwind_inner::h5ef900798574fe5egaJ
   4:        0x10c4ec45e - rt::unwind::begin_unwind::h2748891250859470333
   5:        0x10c4ecc89 - diagnostic::Handler::bug::h57426bf76a5037d4pgB
   6:        0x10a06b4bf - middle::traits::select::SelectionContext&lt;'cx, 'tcx&gt;::rematch_impl::h3b4e834c3872ae21NVR
   7:        0x10a06ab56 - middle::infer::InferCtxt&lt;'a, 'tcx&gt;::try::h6881848181392734290
   8:        0x10a0510c4 - middle::traits::select::SelectionContext&lt;'cx, 'tcx&gt;::confirm_candidate::ha7bb241f7d3cdb480iR
   9:        0x10a025b8d - middle::traits::select::SelectionContext&lt;'cx, 'tcx&gt;::select::hb97262a482e0a260koP
  10:        0x10a0225e0 - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::select::hcffa8f4e81b26cc8HhN
  11:        0x10a021aee - middle::traits::fulfill::FulfillmentContext&lt;'tcx&gt;::select_where_possible::h0a2ed0d6733c5352VgN
  12:        0x10942d473 - check::vtable::select_fcx_obligations_where_possible::h796cff45179b9501A4b
  13:        0x10942cfc3 - check::vtable::select_all_fcx_obligations_and_apply_defaults::hfadb66c912bf39a2X0b
  14:        0x1094de47e - check::check_bare_fn::heb3c8094aebf74083nn
  15:        0x1094d68eb - check::check_item::h25c21617996c325dOGn
  16:        0x1095afed6 - check_crate::closure.35998
  17:        0x1095aad9a - check_crate::haa845b167eb64ccfOmC
  18:        0x1092e4477 - driver::phase_3_run_analysis_passes::h8f332883f9aa5c0arGa
  19:        0x1092ca4b7 - driver::compile_input::h0311d7070ac04983Rba
  20:        0x109384093 - run_compiler::hbe451b463527cb69s2b
  21:        0x109381bb5 - thunk::F.Invoke&lt;A, R&gt;::invoke::h777505636365567823
  22:        0x109380f77 - rt::unwind::try::try_fn::h5237749675862334843
  23:        0x10ce5dfa8 - rust_try_inner
  24:        0x10ce5df95 - rust_try
  25:        0x109381315 - thunk::F.Invoke&lt;A, R&gt;::invoke::h424791141543398798
  26:        0x10cdc299d - sys::thread::create::thread_start::h760927331a49c0e267H
  27:     0x7fff91d6b267 - _pthread_body
  28:     0x7fff91d6b1e4 - _pthread_start
</code></pre></div>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#[no_std];
#[lang=&quot;start&quot;] mod x {}
fn main() {}"><pre class="notranslate"><span class="pl-c1">#<span class="pl-kos">[</span>no_std<span class="pl-kos">]</span></span><span class="pl-kos">;</span>
<span class="pl-c1">#<span class="pl-kos">[</span>lang=<span class="pl-s">"start"</span><span class="pl-kos">]</span></span> <span class="pl-k">mod</span> x <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: internal compiler error: node_id_to_type: no type for node `mod x (id=2)`"><pre class="notranslate"><code class="notranslate">error: internal compiler error: node_id_to_type: no type for node `mod x (id=2)`
</code></pre></div>