title: Use of undeclared type or module core::fmt::Display
body: <p>I have some code that works fine with exact types, but when I add generics it throws an error.</p>
  <p>It gives me the following error, my code is below:</p>
  <blockquote>
  <p>The trait <code>core::fmt::Display</code> is not implemented for the type <code>T</code> [E0277]</p>
  </blockquote>
  <pre><code>fn own&lt;T&gt;(x: T) -&gt; T 
  { 
      x 
  }
  
  struct Node&lt;T&gt;
  {
      value: T,
      next: Option&lt;Box&lt;Node&lt;T&gt;&gt;&gt;
  }
  
  impl&lt;T&gt; Node&lt;T&gt;
  {
      fn print(&amp;self)
      {
          let mut current = self;
          loop {
              println!(&quot;{}&quot;, current.value);
              match current.next {
                  Some(ref next) =&gt; { current = &amp;**next; },
                  None =&gt; break,
              }
          } 
      }
      
      fn add(&amp;mut self, node: Node&lt;T&gt;)
      {
          let item = Some(Box::new(node));
          let mut current = self;
          loop {
              match own(current).next {
                  ref mut slot @ None =&gt; { *slot = item; return },
                  Some(ref mut next) =&gt; current = next
              }
          } 
      }
  }
  
  fn main() {  
      let leaf = Node { value: 10, next: None };
      let branch = Node { value : 50, next: Some(Box::new(leaf)) };
      let mut root = Node { value : 100, next: Some(Box::new(branch)) };
      root.print(); 
      
      let new_leaf = Node { value: 5, next: None };
      root.add(new_leaf);
      root.print();
  }
  </code></pre>
  <p>I understand that this is a common error for generics in all languages, but when I try to add constraints to generics I get another error:</p>
  <blockquote>
  <p><code>&lt;anon&gt;:12:8: 12:26 error: failed to resolve. Use of undeclared type or module core::fmt</code></p>
  <p><code>&lt;anon&gt;:12 impl&lt;T:core::fmt::Display&gt; Node&lt;T&gt;</code></p>
  </blockquote>
  <p>Why does it appear if I have copied the full qualified name from error and inserted it as a constraint?<br />
  It also doesn't work with another traits, for example <code>impl&lt;T:Num&gt;</code></p>
  <p><a href="http://is.gd/67BdMW" rel="nofollow noreferrer">(Playground)</a></p>