title: Why does a File need to be mutable to call Read::read_to_string?
body: <p>Here's a line from the <a href="https://doc.rust-lang.org/book/second-edition/ch12-02-reading-a-file.html#reading-a-file" rel="noreferrer">2nd edition Rust tutorial</a>:</p>
  
  <pre><code>let mut f = File::open(filename).expect("file not found");
  </code></pre>
  
  <p>I'm of the assumption that the file descriptor is a wrapper around a number that basically doesn't change and is read-only.</p>
  
  <p>The compiler complains that the file cannot be borrowed mutably, and I'm assuming it's because the method <code>read_to_string</code> takes the instance as the <code>self</code> argument as mutable, but the question is <strong>"why"</strong>?  What is ever going to change about the file descriptor?  Is it keeping track of the cursor location or something?</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0596]: cannot borrow immutable local variable `fdesc` as mutable
    --&gt; main.rs:13:5
     |
  11 |     let fdesc = File::open(fname).expect("file not found");
     |         ----- consider changing this to `mut fdesc`
  12 |     let mut fdata = String::new();
  13 |     fdesc.read_to_string(&amp;mut fdata)
     |     ^^^^^ cannot borrow mutably
  </code></pre>
  
  <p>The whole source:</p>
  
  <pre><code>fn main() {
      let args: Vec&lt;String&gt; = env::args().collect();
      let query = &amp;args[1];
      let fname = &amp;args[2];
      println!("Searching for '{}' in file '{}'...", query, fname);
  
      let fdesc = File::open(fname).expect("file not found"); //not mut
      let mut fdata = String::new();
      fdesc.read_to_string(&amp;mut fdata)
          .expect("something went wrong reading the file");
  
      println!("Found: \n{}", fdata);
  }
  </code></pre>