title: What do I have to do to solve a "use of moved value" error?
body: <p>I'm trying to compute the 10,001st prime in Rust (Project Euler 7), and as a part of this, my method to check whether or not an integer is prime references a vector:</p>
  
  <pre><code>fn main() {
      let mut count: u32 = 1;
      let mut num: u64 = 1;
      let mut primes: Vec&lt;u64&gt; = Vec::new();
      primes.push(2);
  
      while count &lt; 10001 {
          num += 2;
          if vectorIsPrime(num, primes) {
              count += 1;
              primes.push(num);
          }
      }
  }
  
  fn vectorIsPrime(num: u64, p: Vec&lt;u64&gt;) -&gt; bool {
      for i in p {
          if num &gt; i &amp;&amp; num % i != 0 {
              return false;
          }
      }
  
      true
  }
  </code></pre>
  
  <p>When I try to reference the vector, I get the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0382]: use of moved value: `primes`
   --&gt; src/main.rs:9:31
    |
  9 |         if vectorIsPrime(num, primes) {
    |                               ^^^^^^ value moved here, in previous iteration of loop
    |
    = note: move occurs because `primes` has type `std::vec::Vec&lt;u64&gt;`, which does not implement the `Copy` trait
  </code></pre>
  
  <p>What do I have to do to <code>primes</code> in order to be able to access it within the <code>vectorIsPrime</code> function?</p>