How can I do a mutable borrow in a for loop?
<p>I tried:</p>
<pre class="lang-rust prettyprint-override"><code>fn main() {
    let mut vec = [1, 2, 3];
    
    for mut x in &amp;vec { *x = 3; }
    for mut &amp;x in &amp;vec { x = 3; }
    for mut *x in &amp;vec { x = 3; }
    for mut x in mut &amp;vec { *x = 3; }
    for mut x in &amp;(mut vec) { *x = 3; }
}
</code></pre>
<p>None of these work; how should I do it?</p>
<p>I get errors like:</p>
<blockquote>
<ul>
<li><code>mut</code> must be attached to each individual binding</li>
<li>expected identifier, found <code>*</code></li>
<li>expected expression, found keyword <code>mut</code></li>
<li>cannot assign to <code>*x</code> which is behind a <code>&amp;</code> reference</li>
</ul>
</blockquote>