title: Why does applying & to a String return a &str?
body: <p>In this example code <a href="https://doc.rust-lang.org/std/string/struct.String.html" rel="nofollow">from the Rust documentation</a>:</p>
  
  <pre><code>fn takes_str(s: &amp;str) { }
  
  let s = String::from("Hello");
  
  takes_str(&amp;s);
  </code></pre>
  
  <p>What exactly is going on behind the scenes that causes <code>&amp;s</code> to become a <code>&amp;str</code> instead of a <code>&amp;String</code>?  The documentation seems to suggest that there's some dereferencing going on, but I thought <code>*</code> was for dereferencing, not <code>&amp;</code>?</p>