<p dir="auto">The code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fn main() {
    let v: Vec&lt;i32&gt; = Vec::new();
    loop {
        drop(v);
    }
}"><pre class="notranslate"><code class="notranslate">fn main() {
    let v: Vec&lt;i32&gt; = Vec::new();
    loop {
        drop(v);
    }
}
</code></pre></div>
<p dir="auto">The error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:4:14: 4:15 error: use of moved value: `v`
&lt;anon&gt;:4         drop(v);
                      ^
&lt;anon&gt;:4:14: 4:15 note: `v` moved here because it has type `collections::vec::Vec&lt;i32&gt;`, which is non-copyable
&lt;anon&gt;:4         drop(v);
                      ^"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:4:14: 4:15 error: use of moved value: `v`
&lt;anon&gt;:4         drop(v);
                      ^
&lt;anon&gt;:4:14: 4:15 note: `v` moved here because it has type `collections::vec::Vec&lt;i32&gt;`, which is non-copyable
&lt;anon&gt;:4         drop(v);
                      ^
</code></pre></div>
<p dir="auto">In this simple example, it is pretty easy to notice that the error happens in the next iteration. However, usually the code is more complicated than this and the error is very confusing (see <a href="http://www.reddit.com/r/rust/comments/2u2koa/confusing_use_of_moved_value_error/" rel="nofollow">this reddit thread</a>). Maybe we could add something like <code class="notranslate">move happens in the next iteration of the loop</code>.</p>
<p dir="auto">When the borrow check fails in a loop, the error message can be quite confusing:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="enum Nat {
    S(~Nat),
    Z
}
fn test(x: &amp;mut Nat) {
    let mut p = &amp;mut *x;
    loop {
        match p {
            &amp;Z =&gt; break,
            &amp;S(~ref mut n) =&gt; p = &amp;mut *n
        }
    }
}"><pre class="notranslate"><span class="pl-k">enum</span> <span class="pl-smi">Nat</span> <span class="pl-kos">{</span>
    <span class="pl-v">S</span><span class="pl-kos">(</span>~<span class="pl-smi">Nat</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
    <span class="pl-v">Z</span>
<span class="pl-kos">}</span>
<span class="pl-k">fn</span> <span class="pl-en">test</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">Nat</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> <span class="pl-k">mut</span> p = <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-c1">*</span>x<span class="pl-kos">;</span>
    <span class="pl-k">loop</span> <span class="pl-kos">{</span>
        <span class="pl-k">match</span> p <span class="pl-kos">{</span>
            <span class="pl-c1">&amp;</span><span class="pl-v">Z</span> =&gt; <span class="pl-k">break</span><span class="pl-kos">,</span>
            <span class="pl-c1">&amp;</span><span class="pl-v">S</span><span class="pl-kos">(</span>~<span class="pl-k">ref</span> <span class="pl-k">mut</span> n<span class="pl-kos">)</span> =&gt; p = <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-c1">*</span>n
        <span class="pl-kos">}</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">The borrow checker informs me:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Test.rs|43 col 16 error| cannot borrow `*(*p)#0` as mutable more than once at a time
Test.rs|43 col 16 n| second borrow of `*(*p)#0` as mutable occurs here"><pre class="notranslate"><code class="notranslate">Test.rs|43 col 16 error| cannot borrow `*(*p)#0` as mutable more than once at a time
Test.rs|43 col 16 n| second borrow of `*(*p)#0` as mutable occurs here
</code></pre></div>
<p dir="auto">This message is confusing, because the two occurrences have the same line number and column. In fact, the error message is right: the borrow check only fails because it is being performed in a loop. The error message should mention something like that to the effect.</p>