<p dir="auto">It's a common beginner's problem to create a vector with run-time size filled with identical values, but the idiomatic solution is pretty much undiscoverable without asking people on IRC/StackOverflow/Reddit.</p>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/steveklabnik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/steveklabnik">@steveklabnik</a></p>
<p dir="auto">Rustc sometimes recognizes and logs the same error multiple times.</p>
<p dir="auto">Test case: <a href="https://gist.github.com/reem/78db1ad233f1c87f9ca7">https://gist.github.com/reem/78db1ad233f1c87f9ca7</a></p>
<p dir="auto"><code class="notranslate">rustc --test</code> consistently logs (note the double report on the L#33 error):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="lib.rs:33:5: 33:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for fn(uint) -&gt; uint
lib.rs:33     replace_map(b, double);
              ^~~~~~~~~~~
lib.rs:33:5: 33:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for fn(uint) -&gt; uint
lib.rs:33     replace_map(b, double);
              ^~~~~~~~~~~
lib.rs:36:5: 36:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for closure
lib.rs:36     replace_map(b, |&amp;mut: x: uint| x * 2);
              ^~~~~~~~~~~
lib.rs:39:5: 39:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for closure
lib.rs:39     replace_map(b, |&amp;: x: uint| x * 2);
              ^~~~~~~~~~~
error: aborting due to 4 previous errors"><pre class="notranslate"><code class="notranslate">lib.rs:33:5: 33:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for fn(uint) -&gt; uint
lib.rs:33     replace_map(b, double);
              ^~~~~~~~~~~
lib.rs:33:5: 33:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for fn(uint) -&gt; uint
lib.rs:33     replace_map(b, double);
              ^~~~~~~~~~~
lib.rs:36:5: 36:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for closure
lib.rs:36     replace_map(b, |&amp;mut: x: uint| x * 2);
              ^~~~~~~~~~~
lib.rs:39:5: 39:16 error: failed to find an implementation of trait core::ops::FnOnce&lt;(uint),uint&gt; for closure
lib.rs:39     replace_map(b, |&amp;: x: uint| x * 2);
              ^~~~~~~~~~~
error: aborting due to 4 previous errors
</code></pre></div>