title: Can Rust optimise away the bit-wise copy during move of an object someday?
body: <p>Consider the snippet</p>
  
  <pre><code>struct Foo {
      dummy: [u8; 65536],
  }
  
  fn bar(foo: Foo) {
      println!("{:p}", &amp;foo)
  }
  
  fn main() {
      let o = Foo { dummy: [42u8; 65536] };
      println!("{:p}", &amp;o);
      bar(o);
  }
  </code></pre>
  
  <p>A typical <a href="https://play.rust-lang.org/?gist=cfb02304ff465361d0dd59141bb13667&amp;version=stable&amp;backtrace=0" rel="noreferrer">result</a> of the program is</p>
  
  <pre class="lang-none prettyprint-override"><code>0x7fffc1239890
  0x7fffc1229890
  </code></pre>
  
  <p>where the addresses are different.</p>
  
  <p>Apparently, the large array <code>dummy</code> has been copied, as expected in the compiler's move implementation. Unfortunately, this can have non-trivial performance impact, as <code>dummy</code> is a very large array. This impact can force people to choose passing argument by reference instead, even when the function actually "consumes" the argument conceptually.</p>
  
  <p>Since <code>Foo</code> does not derive <code>Copy</code>, object <code>o</code> is moved. Since Rust forbids the access of moved object, what is preventing <code>bar</code> to "reuse" the original object <code>o</code>, forcing the compiler to generate a potentially expensive bit-wise copy? Is there a fundamental difficulty, or will we see the compiler someday optimise away this bit-wise copy?</p>