<p dir="auto">Using commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/7fbbfe6bf29b984275c9bc59754e8ec053838781/hovercard" href="https://github.com/rust-lang/rust/commit/7fbbfe6bf29b984275c9bc59754e8ec053838781"><tt>7fbbfe6</tt></a> I am experiencing this failure during <code class="notranslate">make check</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="metrics saved to: tmp/check-stage2-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-std-metrics.json
failures:

---- io::process::tests::test_override_env::green stdout ----
    task 'io::process::tests::test_override_env::green' failed at 'called `Result::unwrap()` on an `Err` value: no such file or directory (no such file or directory)', /tmp/nix-build-rustc-0.12.0-pre-7fbbfe6bf.drv-0/git-export/src/libcore/result.rs:808


---- io::process::tests::test_override_env::native stdout ----
    task 'io::process::tests::test_override_env::native' failed at 'receiving on a closed channel', /tmp/nix-build-rustc-0.12.0-pre-7fbbfe6bf.drv-0/git-export/src/libsync/comm/mod.rs:837



failures:
    io::process::tests::test_override_env::green
    io::process::tests::test_override_env::native

test result: FAILED. 833 passed; 2 failed; 63 ignored; 0 measured

task '&lt;main&gt;' failed at 'Some tests failed', /tmp/nix-build-rustc-0.12.0-pre-7fbbfe6bf.drv-0/git-export/src/libtest/lib.rs:243
make: *** [tmp/check-stage2-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-std.ok] Error 101"><pre class="notranslate"><code class="notranslate">metrics saved to: tmp/check-stage2-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-std-metrics.json
failures:

---- io::process::tests::test_override_env::green stdout ----
    task 'io::process::tests::test_override_env::green' failed at 'called `Result::unwrap()` on an `Err` value: no such file or directory (no such file or directory)', /tmp/nix-build-rustc-0.12.0-pre-7fbbfe6bf.drv-0/git-export/src/libcore/result.rs:808


---- io::process::tests::test_override_env::native stdout ----
    task 'io::process::tests::test_override_env::native' failed at 'receiving on a closed channel', /tmp/nix-build-rustc-0.12.0-pre-7fbbfe6bf.drv-0/git-export/src/libsync/comm/mod.rs:837



failures:
    io::process::tests::test_override_env::green
    io::process::tests::test_override_env::native

test result: FAILED. 833 passed; 2 failed; 63 ignored; 0 measured

task '&lt;main&gt;' failed at 'Some tests failed', /tmp/nix-build-rustc-0.12.0-pre-7fbbfe6bf.drv-0/git-export/src/libtest/lib.rs:243
make: *** [tmp/check-stage2-T-x86_64-unknown-linux-gnu-H-x86_64-unknown-linux-gnu-std.ok] Error 101
</code></pre></div>
<p dir="auto">Initially I thought it was because my OS (NixOS) did not install <code class="notranslate">env</code> in /usr/bin (in fact, /usr doesn't even exist, but env is in the PATH), but even then, that does not explain why other env tests succeed (such as test_add_to_env, which is almost exactly the same code as test_override_env).</p>
<p dir="auto">However, if I copy/paste the code from the test into a new program and run it, it seems to work fine.</p>
<p dir="auto">Furthermore, this exact <code class="notranslate">make check</code> failure seems to be repeatable, even after updating to a newer commit and compiling everything from scratch.</p>
<p dir="auto">This seems quite mysterious to me... any ideas as to what the problem might be?</p>
<p dir="auto">It seems that <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="53628346" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/20692" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/20692/hovercard" href="https://github.com/rust-lang/rust/issues/20692">#20692</a> is not only a case for duplicate error messages as shown by</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
    let array = [1, 2, 3];
    for a in array {
        println!( &quot;{}&quot;, a);
    }
}"><pre class="notranslate"><span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">let</span> array = <span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">,</span> <span class="pl-c1">2</span><span class="pl-kos">,</span> <span class="pl-c1">3</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
    <span class="pl-k">for</span> a <span class="pl-k">in</span> array <span class="pl-kos">{</span>
        <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span> <span class="pl-s">"{}"</span>, a<span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Which print the error 3 times.</p>
<p dir="auto">It is the same as the other case about map </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/rust-lang/rust/blob/7ae4a8e9f3150f62964151ef54b3da3cd24ee123/src/librustc/middle/traits/object_safety.rs#L78-L85">rust/src/librustc/middle/traits/object_safety.rs</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 78 to 85
      in
      <a data-pjax="true" class="commit-tease-sha" href="/rust-lang/rust/commit/7ae4a8e9f3150f62964151ef54b3da3cd24ee123">7ae4a8e</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L78" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="78"></td>
          <td id="LC78" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">object_safety_violations</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">tcx</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">tcx</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span>ty<span class="pl-kos">::</span><span class="pl-smi">ctxt</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">tcx</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L79" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="79"></td>
          <td id="LC79" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">                                       <span class="pl-s1">trait_def_id</span><span class="pl-kos">:</span> ast<span class="pl-kos">::</span><span class="pl-smi">DefId</span><span class="pl-kos">)</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L80" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="80"></td>
          <td id="LC80" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">                                       -&gt; <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">ObjectSafetyViolation</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">tcx</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L81" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="81"></td>
          <td id="LC81" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-kos">{</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L82" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="82"></td>
          <td id="LC82" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     traits<span class="pl-kos">::</span><span class="pl-en">supertrait_def_ids</span><span class="pl-kos">(</span>tcx<span class="pl-kos">,</span> trait_def_id<span class="pl-kos">)</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L83" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="83"></td>
          <td id="LC83" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-kos">.</span><span class="pl-en">flat_map</span><span class="pl-kos">(</span>|def_id| <span class="pl-en">object_safety_violations_for_trait</span><span class="pl-kos">(</span>tcx<span class="pl-kos">,</span> def_id<span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">into_iter</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L84" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="84"></td>
          <td id="LC84" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-kos">.</span><span class="pl-en">collect</span><span class="pl-kos">(</span><span class="pl-kos">)</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L85" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="85"></td>
          <td id="LC85" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-kos">}</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">originally spot at <a href="https://users.rust-lang.org/t/iterator-and-differences-between-array-and-array/2672" rel="nofollow">https://users.rust-lang.org/t/iterator-and-differences-between-array-and-array/2672</a></p>
<hr>
<p dir="auto">I think implementing <code class="notranslate">distinct</code>so that you can collect only the different items could be a good way to start solving this in the board way (all across scala error reporting).</p>