title: Rust, Copy Trait not working with a type when it uses generic
body: <p>Rust won't compile the following:</p>
  
  <pre><code>#[derive(Copy, Clone)]
  struct WhateverStruct&lt;T&gt; {
      field : T
  }
  
  trait WhateverStructTrait&lt;T&gt; {
      fn to(self) -&gt; WhateverStruct&lt;T&gt;;
  }
  impl&lt;T&gt; WhateverStructTrait&lt;T&gt; for *mut WhateverStruct&lt;T&gt; {
      fn to(self) -&gt; WhateverStruct&lt;T&gt; {
          unsafe {* self }
      }
  }
  
  fn test() {
      let x = WhateverStruct { field : 7u32 };
      let _y = x;
      let _z = x;
      println!("Copying is fine");
  }
  
  fn main() {
      test();
  }
  </code></pre>
  
  <p>It complains on the  unsafe <code>{* self }</code> part saying that </p>
  
  <blockquote>
    <p><code>*self</code> has type <code>WhateverStruct&lt;T&gt;</code>, which does not implement the <code>Copy</code> trait</p>
  </blockquote>
  
  <p>However, it quite clearly does implement the copy trait.  The test function has no errors.  If you change <code>struct WhateverStruct&lt;T&gt; { field : T }</code> into <code>struct WhateverStruct { field : u32 }</code> and remove the <code>&lt;T&gt;</code> from the rest of the code, everything compiles and runs just fine.  So Rust isn't liking the generic.</p>
  
  <p>Here you can see on the playground : <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=5d5c3a0f0e6e0153ec286ce38f0f3a2d" rel="nofollow noreferrer">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=5d5c3a0f0e6e0153ec286ce38f0f3a2d</a></p>
  
  <p>Is this a bug?  Is there a work around?</p>