<p dir="auto">We can now run tests under helgrind. For bonus fun we should be able to run under thread sanitizer (a google-backed valgrind plugin) which does similar-but-different things.</p>
<p dir="auto">Currently, the following fails to compile:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct Foo&lt;T&gt;;

impl&lt;'a, T&gt; Foo&lt;&amp;'a T&gt; {
    fn foo(&amp;self) {}
}
impl&lt;'a, T&gt; Foo&lt;&amp;'a mut T&gt; {
    fn foo(&amp;self) {}
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">Foo</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>

<span class="pl-k">impl</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">,</span> <span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-smi">Foo</span><span class="pl-kos">&lt;</span><span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-kos">}</span>
<span class="pl-k">impl</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">,</span> <span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-smi">Foo</span><span class="pl-kos">&lt;</span><span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-k">mut</span> <span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-smi">self</span><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">The error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:7:5: 7:21 error: duplicate definition of value `foo`
&lt;anon&gt;:7     fn foo(&amp;self) {}
             ^~~~~~~~~~~~~~~~
&lt;anon&gt;:4:5: 4:21 note: first definition of value `foo` here
&lt;anon&gt;:4     fn foo(&amp;self) {}
             ^~~~~~~~~~~~~~~~"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:7:5: 7:21 error: duplicate definition of value `foo`
&lt;anon&gt;:7     fn foo(&amp;self) {}
             ^~~~~~~~~~~~~~~~
&lt;anon&gt;:4:5: 4:21 note: first definition of value `foo` here
&lt;anon&gt;:4     fn foo(&amp;self) {}
             ^~~~~~~~~~~~~~~~
</code></pre></div>
<p dir="auto">If you construct an analogous situation using two separate impls of a trait providing <code class="notranslate">foo</code>, it works just fine, because there is no overlap. Inherent impl blocks could be similarly flexible.</p>