title: Printing the Arc and Mutex types
body: <p>How can I print the values of a <code>Vec</code> that is encapsulated by a <code>Mutex</code> and <code>Arc</code>? I'm really new to Rust, so I'm not sure if I am phrasing this well.</p>
  
  <p>This is the code I have, loosely based on the documentation.</p>
  
  <pre><code>use std::sync::{Arc, Mutex};
  use std::thread;
  
  fn main() {
      let data = Arc::new(Mutex::new(vec![104, 101, 108, 108, 111]));
  
      for i in 0..2 {
          let data = data.clone();
          thread::spawn(move || {
              let mut data = data.lock().unwrap();
              data[i] += 1;
          });
      }
  
      println!("{:?}", String::from_utf8(data).unwrap());
      thread::sleep_ms(50);
  }
  </code></pre>
  
  <p>The error that the compiler gives me: </p>
  
  <blockquote>
    <p>$ rustc datarace_fixed.rs
    datarace_fixed.rs:14:37: 14:41 error: mismatched types:
     expected <code>collections::vec::Vec&lt;u8&gt;</code>,
        found <code>alloc::arc::Arc&lt;std::sync::mutex::Mutex&lt;collections::vec::Vec&lt;_&gt;&gt;&gt;</code>
    (expected struct <code>collections::vec::Vec</code>,
        found struct <code>alloc::arc::Arc</code>) [E0308]
    datarace_fixed.rs:14    println!("{:?}", String::from_utf8(data).unwrap());</p>
  </blockquote>