title: Borrow and use of moved value
body: <p>I'm writing a ASCII Pokémon game and have come across a ownership error:</p>
  <pre><code>use std::fs::File;
  use std::io::{BufRead, BufReader};
  
  pub fn parse_map(filename: &amp;str) -&gt; (Vec&lt;String&gt;, Vec&lt;String&gt;) {
      let file = File::open(filename).unwrap();
      let reader = BufReader::new(file);
  
      let mut map_vec = Vec::new();
      let mut portal_vec = Vec::new();
  
      let mut reading_map = false;
      let mut reading_portals = false;
  
      for (index, line) in reader.lines().enumerate() {
          let read_line = line.unwrap();
  
          if read_line == &quot;end&quot; {
              reading_map = false;
              reading_portals = false;
          }
  
          if reading_map {
              map_vec.push(read_line);
          }
          if reading_portals {
              portal_vec.push(read_line);
          }
  
          if read_line == &quot;map&quot; {
              reading_map = true;
          }
          if read_line == &quot;portals&quot; {
              reading_portals = true;
          }
      }
  
      return (map_vec, portal_vec);
  }
  </code></pre>
  <p>and here are the errors</p>
  <pre class="lang-none prettyprint-override"><code>error[E0382]: use of moved value: `read_line`
    --&gt; src/lib.rs:26:29
     |
  15 |         let read_line = line.unwrap();
     |             --------- move occurs because `read_line` has type `std::string::String`, which does not implement the `Copy` trait
  ...
  23 |             map_vec.push(read_line);
     |                          --------- value moved here
  ...
  26 |             portal_vec.push(read_line);
     |                             ^^^^^^^^^ value used here after move
  ...
  35 |     }
     |     - value moved here, in previous iteration of loop
  
  error[E0382]: borrow of moved value: `read_line`
    --&gt; src/lib.rs:29:12
     |
  15 |         let read_line = line.unwrap();
     |             --------- move occurs because `read_line` has type `std::string::String`, which does not implement the `Copy` trait
  ...
  23 |             map_vec.push(read_line);
     |                          --------- value moved here
  ...
  26 |             portal_vec.push(read_line);
     |                             --------- value moved here
  ...
  29 |         if read_line == &quot;map&quot; {
     |            ^^^^^^^^^ value borrowed here after move
  ...
  35 |     }
     |     - value moved here, in previous iteration of loop
  </code></pre>