<p dir="auto">The following program calls 'fail!()', but still results in an exit code of zero:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="fn main () {
    os::args();
    fail!();
}"><pre class="notranslate"><code class="notranslate">fn main () {
    os::args();
    fail!();
}
</code></pre></div>
<p dir="auto">Here's what it looks like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="jclements-09740:~/clements/projects/rust-experimenting clements&gt; rustc ./foo.rs &amp;&amp; ./foo &amp;&amp; echo &quot;done&quot; 
Running /usr/local/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
rust: task failed at 'explicit failure', ./foo.rs:3
done"><pre class="notranslate"><code class="notranslate">jclements-09740:~/clements/projects/rust-experimenting clements&gt; rustc ./foo.rs &amp;&amp; ./foo &amp;&amp; echo "done" 
Running /usr/local/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
rust: task failed at 'explicit failure', ./foo.rs:3
done
</code></pre></div>
<p dir="auto">Commenting out the call to "os::args()" produces the expected output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="jclements-09740:~/clements/projects/rust-experimenting clements&gt; rustc ./foo.rs &amp;&amp; ./foo &amp;&amp; echo &quot;done&quot;
Running /usr/local/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
rust: task failed at 'explicit failure', ./foo.rs:3
rust: domain main @0x7fdd91815e10 root task failed"><pre class="notranslate"><code class="notranslate">jclements-09740:~/clements/projects/rust-experimenting clements&gt; rustc ./foo.rs &amp;&amp; ./foo &amp;&amp; echo "done"
Running /usr/local/bin/rustc:
warning: no debug symbols in executable (-arch x86_64)
rust: task failed at 'explicit failure', ./foo.rs:3
rust: domain main @0x7fdd91815e10 root task failed
</code></pre></div>
<p dir="auto">... note the extra line of output, and the lack of the "done" message, indicating a nonzero exit code.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() {
  os::args();
  assert!(false);
}"><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>
  os<span class="pl-kos">::</span><span class="pl-en">args</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-en">assert</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-c1">false</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">Causes the program to return with exit status 0. Thankfully removing <code class="notranslate">os::args()</code> makes it return with nonzero, but it appears that at any point after the invocation of <code class="notranslate">os::args()</code> an assertion failure will cause an exit status of 0.</p>
<p dir="auto">I ran this against a compiler built at <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/e51ec26dd7d915cfdfabcf5b6e32c001e30bd244/hovercard" href="https://github.com/rust-lang/rust/commit/e51ec26dd7d915cfdfabcf5b6e32c001e30bd244"><tt>e51ec26</tt></a></p>