<p dir="auto">Playpen: <a href="http://is.gd/XdDyHg" rel="nofollow">http://is.gd/XdDyHg</a></p>
<p dir="auto">Inline:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub trait Editor&lt;Cntx&gt; where Cntx: Context&lt;Self&gt; {}

pub trait Context&lt;Edtr&gt; where Edtr: Editor&lt;Self&gt; {}"><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">Editor</span><span class="pl-kos">&lt;</span><span class="pl-smi">Cntx</span><span class="pl-kos">&gt;</span> <span class="pl-k">where</span> <span class="pl-smi">Cntx</span><span class="pl-kos">:</span> <span class="pl-smi">Context</span><span class="pl-kos">&lt;</span><span class="pl-smi">Self</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">trait</span> <span class="pl-smi">Context</span><span class="pl-kos">&lt;</span><span class="pl-smi">Edtr</span><span class="pl-kos">&gt;</span> <span class="pl-k">where</span> <span class="pl-smi">Edtr</span><span class="pl-kos">:</span> <span class="pl-smi">Editor</span><span class="pl-kos">&lt;</span><span class="pl-smi">Self</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<p dir="auto">Failure:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="task 'rustc' has overflowed its stack"><pre class="notranslate"><code class="notranslate">task 'rustc' has overflowed its stack
</code></pre></div>
<p dir="auto">This code causes rustc's stack to overflow:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="trait Hash&lt;H: Hasher&gt; { }
trait Hasher&lt;H: Hash&gt; { }

trait StreamHash&lt;H: StreamHasher&gt;: Hash&lt;H&gt; { }
trait StreamHasher&lt;H: StreamHash&gt;: Hasher&lt;H&gt; { }

fn main() {
}"><pre class="notranslate"><code class="notranslate">trait Hash&lt;H: Hasher&gt; { }
trait Hasher&lt;H: Hash&gt; { }

trait StreamHash&lt;H: StreamHasher&gt;: Hash&lt;H&gt; { }
trait StreamHasher&lt;H: StreamHash&gt;: Hasher&lt;H&gt; { }

fn main() {
}
</code></pre></div>
<p dir="auto">As a workaround, you can break up the recursion with another trait:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="trait Hash { }
trait Hasher&lt;H: Hash&gt; { }

trait Stream { }
trait StreamHash&lt;S: Stream&gt;: Hash { }
trait StreamHasher&lt;H: StreamHash&lt;Self&gt;&gt;: Stream + Hasher&lt;H&gt; { }

fn main() { }"><pre class="notranslate"><code class="notranslate">trait Hash { }
trait Hasher&lt;H: Hash&gt; { }

trait Stream { }
trait StreamHash&lt;S: Stream&gt;: Hash { }
trait StreamHasher&lt;H: StreamHash&lt;Self&gt;&gt;: Stream + Hasher&lt;H&gt; { }

fn main() { }
</code></pre></div>