title: Attempting to destruct a HashMap Entry leads to "cannot move out of dereference of `RefMut (...) which does not implement the `Copy` trait"
body: <p>Consider this code:</p>
  <pre><code>use std::io::BufRead;
  use std::io::{self};
  
  use flate2::write::GzEncoder;
  use flate2::Compression;
  use std::fs::File;
  use std::io::Write;
  
  use std::cell::RefCell;
  
  use std::collections::hash_map::Entry;
  use std::collections::HashMap;
  
  fn main() -&gt; io::Result&lt;()&gt; {
      let mut stdin = io::stdin();
      let mut gzfiles = HashMap::new();
      for result in stdin.lock().lines() {
          let line = result.unwrap();
          let year: String = (&amp;line[0..4]).into();
          match gzfiles.entry(year.clone()) {
              Entry::Vacant(entry) =&gt; {
                  let output = File::create(year.clone()).unwrap();
                  let mut encoder = GzEncoder::new(output, Compression::default());
                  encoder.write(line.as_bytes());
                  entry.insert(RefCell::new(encoder));
              }
              Entry::Occupied(mut entry) =&gt; {
                  let mut encoder = entry.get_mut().borrow_mut();
                  encoder.write(line.as_bytes());
              }
          }
      }
  
      for v in gzfiles.values_mut() {
          v.borrow_mut().finish().unwrap();
      }
  
      Ok(())
  }
  </code></pre>
  <p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=133abb3ad4c7c9af002776742c9853cc" rel="nofollow noreferrer">Rust playground</a></p>
  <p>The goal was to create gzip files for each year and put all matching stdin lines there. For some reason I'm getting the following error:</p>
  <pre><code>   Compiling playground v0.0.1 (/playground)
  warning: variable does not need to be mutable
    --&gt; src/main.rs:15:9
     |
  15 |     let mut stdin = io::stdin();
     |         ----^^^^^
     |         |
     |         help: remove this `mut`
     |
     = note: `#[warn(unused_mut)]` on by default
  
  error[E0507]: cannot move out of dereference of `RefMut&lt;'_, flate2::write::GzEncoder&lt;File&gt;&gt;`
    --&gt; src/main.rs:35:9
     |
  35 |         v.borrow_mut().finish().unwrap();
     |         ^^^^^^^^^^^^^^ move occurs because value has type `flate2::write::GzEncoder&lt;File&gt;`, which does not implement the `Copy` trait
  
  For more information about this error, try `rustc --explain E0507`.
  warning: `playground` (bin &quot;playground&quot;) generated 1 warning
  error: could not compile `playground` due to previous error; 1 warning emitted
  </code></pre>
  <p>What is the compiler complaining about and how to fix it?</p>