<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Bound where u8: Into&lt;Self&gt; {}

// u8: Into&lt;Self&gt; is enforced here:
// error: the trait `core::convert::From&lt;u8&gt;` is not implemented for the type `u16`  [E0277]
impl Bound for u16 {}
// ^~~~~~~~~~~~~~~~~~

fn test&lt;B: Bound&gt;() -&gt; B {
    // but the compiler seems to be unaware of it here:
    // error: the trait `core::convert::From&lt;u8&gt;` is not implemented for the type `B` [E0277]
    0u8.into()
    //  ^~~~~~
}"><pre class="notranslate"><span class="pl-k">trait</span> <span class="pl-smi">Bound</span> <span class="pl-k">where</span> <span class="pl-smi">u8</span><span class="pl-kos">:</span> <span class="pl-smi">Into</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-c">// u8: Into&lt;Self&gt; is enforced here:</span>
<span class="pl-c">// error: the trait `core::convert::From&lt;u8&gt;` is not implemented for the type `u16`  [E0277]</span>
<span class="pl-k">impl</span> <span class="pl-smi">Bound</span> <span class="pl-k">for</span> <span class="pl-smi">u16</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-c">// ^~~~~~~~~~~~~~~~~~</span>

<span class="pl-k">fn</span> <span class="pl-en">test</span><span class="pl-kos">&lt;</span><span class="pl-smi">B</span><span class="pl-kos">:</span> <span class="pl-smi">Bound</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">B</span> <span class="pl-kos">{</span>
    <span class="pl-c">// but the compiler seems to be unaware of it here:</span>
    <span class="pl-c">// error: the trait `core::convert::From&lt;u8&gt;` is not implemented for the type `B` [E0277]</span>
    <span class="pl-c1">0u8</span><span class="pl-kos">.</span><span class="pl-en">into</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-c">//  ^~~~~~</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">As you can see, the compiler enforces the bound in the traits where clause when implementing the trait, but seems to be unaware of it when the trait is used itself as a bound.</p>
<p dir="auto">I don't know if the traits where clause should be valid or not, however if it is valid, the compiler should be aware of the additional information provided by it.</p>
<p dir="auto">At least if I haven't completely misunderstood something.</p>
<p dir="auto">The following example:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Foo&lt;T&gt; {
   fn foo(&amp;self) -&gt; &amp;T;
}

trait Bar&lt;A&gt; where A: Foo&lt;Self&gt; {}

fn foobar&lt;A, B: Bar&lt;A&gt;&gt;(a: &amp;A) -&gt; &amp;B {
   a.foo()
}"><pre class="notranslate"><span class="pl-k">trait</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">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> -&gt; <span class="pl-c1">&amp;</span><span class="pl-smi">T</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">trait</span> <span class="pl-smi">Bar</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">&gt;</span> <span class="pl-k">where</span> <span class="pl-smi">A</span><span class="pl-kos">:</span> <span class="pl-smi">Foo</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">fn</span> <span class="pl-en">foobar</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">,</span> <span class="pl-smi">B</span><span class="pl-kos">:</span> <span class="pl-smi">Bar</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">A</span><span class="pl-kos">)</span> -&gt; <span class="pl-c1">&amp;</span><span class="pl-smi">B</span> <span class="pl-kos">{</span>
   a<span class="pl-kos">.</span><span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">fails with "error: type <code class="notranslate">&amp;A</code> does not implement any method in scope named <code class="notranslate">foo</code>".</p>
<p dir="auto">This UFCS variant</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Foo&lt;T&gt; {
    fn foo(&amp;self) -&gt; &amp;T;
}

trait Bar&lt;A&gt; where A: Foo&lt;Self&gt; {}

fn foobar&lt;A, B: Bar&lt;A&gt;&gt;(a: &amp;A) -&gt; &amp;B {
    Foo::foo(a)
}"><pre class="notranslate"><span class="pl-k">trait</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">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> -&gt; <span class="pl-c1">&amp;</span><span class="pl-smi">T</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">trait</span> <span class="pl-smi">Bar</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">&gt;</span> <span class="pl-k">where</span> <span class="pl-smi">A</span><span class="pl-kos">:</span> <span class="pl-smi">Foo</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">fn</span> <span class="pl-en">foobar</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">,</span> <span class="pl-smi">B</span><span class="pl-kos">:</span> <span class="pl-smi">Bar</span><span class="pl-kos">&lt;</span><span class="pl-smi">A</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">A</span><span class="pl-kos">)</span> -&gt; <span class="pl-c1">&amp;</span><span class="pl-smi">B</span> <span class="pl-kos">{</span>
    <span class="pl-smi">Foo</span><span class="pl-kos">::</span><span class="pl-en">foo</span><span class="pl-kos">(</span>a<span class="pl-kos">)</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">fails with "error: the trait <code class="notranslate">Foo&lt;_&gt;</code> is not implemented for the type <code class="notranslate">A</code>".</p>