title: Allocate array onto heap with size known at runtime
body: <p>In C++, I could put an array of 1000 <code>int</code>s onto the heap like this:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>int size = 1000;
  int* values = new int[size];
  delete[] values;
  </code></pre>
  
  <p>I can't figure out how to do the equivalent in Rust.</p>
  
  <pre><code>let size = 1000;
  let values = Box::new([0; size]) // error: non-constant path in constant expression
  </code></pre>
  
  <p>To my understanding, Rust forces the size of all arrays to be known at compile time and doesn't let you use expressions when creating arrays.</p>