title: What is the difference between dereferencing a raw pointer to a String and a raw pointer to an i32?
body: <pre><code>fn func(s: *mut String, a: *mut i32) -&gt; usize {
      println!("{}", unsafe { *s });
      println!("{}", unsafe { *a });
  
      unsafe { (*s).len() }
  }
  
  fn main() {
      let mut s = String::from("hello");
      let mut a = 10;
  
      func(&amp;mut s, &amp;mut a);
  }
  </code></pre>
  
  <p>The above code fails with the error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error[E0507]: cannot move out of dereference of raw pointer
   --&gt; src/main.rs:2:29
    |
  2 |     println!("{}", unsafe { *s });
    |                             ^^ cannot move out of dereference of raw pointer
  </code></pre>
  
  <p>Why does it happen for <code>String</code> and not for <code>i32</code>? Why is it complaining of a "move"?</p>