Passing slice as an IntoIterator
<p>I have a function with the following signature:</p>

<pre><code>pub fn history&lt;'a, I: IntoIterator&lt;Item = &amp;'a str&gt;&gt;(&amp;self, _: I)
</code></pre>

<p>Later on, I have a struct with a field called <code>main</code> that is a boxed closure.</p>

<pre><code>main: box |args: &amp;[&amp;str], shell: &amp;mut Shell| {
    shell.history.history(args);
},
</code></pre>

<p>The important part is that I am calling the function I showed the signature for with <code>&amp;[&amp;str]</code> as an argument. I get the following compile error:</p>

<pre><code>src/main.rs:281:47: 281:54 error: type mismatch resolving `&lt;&amp;[&amp;str] as core::iter::IntoIterator&gt;::Item == &amp;str`:
 expected &amp;-ptr,
    found str [E0271]
src/main.rs:281         shell.history.history(args);
</code></pre>

<p>So apparently <code>&amp;[&amp;str]</code> doesn't work as an <code>IntoIterator</code>. I tried <code>shell.history.history(args.into_iter());</code> and got a similar error message.</p>

<p>Strangely, <code>shell.history.history(args.iter().map(|s|*s));</code> does work. This hardly seems like the correct solution though.</p>