title: Using slice patterns with a slice of Strings
body: <p>I am trying to use slice patterns on a slice of <code>String</code>s. This does not work because Rust does not match the <code>String</code>s of the slice with the <code>&amp;str</code> literal. I could not find out how to convert the slice of <code>String</code>s to a slice of <code>&amp;str</code>s.</p>
  
  <pre class="lang-rust prettyprint-override"><code>#![feature(slice_patterns)]
  
  fn main() {
      // A slice of strings.
      let x = ["foo".to_owned(), "bar".to_owned()];
      match x {
          ["foo", y] =&gt; println!("y is {}.", y),
          _ =&gt; println!("I did not expect this."),
      }
  }
  </code></pre>
  
  <p><a href="http://is.gd/0TyjUv" rel="nofollow">Playground</a></p>