<p dir="auto">The following code fails to compile due to the two adjacent <code class="notranslate">&lt;</code>.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="trait Test {
    type X;

    fn foo() -&gt; Option&lt;&lt;Self as Test&gt;::X&gt;;
}"><pre class="notranslate"><span class="pl-k">trait</span> <span class="pl-smi">Test</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">X</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-kos">)</span> -&gt; <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span>&lt;<span class="pl-smi">Self</span> <span class="pl-k">as</span> <span class="pl-smi">Test</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">X</span><span class="pl-kos">&gt;</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="testcase.rs:4:23: 4:25 error: expected `;` or `{`, found `&lt;&lt;`
testcase.rs:4     fn foo() -&gt; Option&lt;&lt;Self as Test&gt;::X&gt;;
                                    ^~"><pre class="notranslate"><code class="notranslate">testcase.rs:4:23: 4:25 error: expected `;` or `{`, found `&lt;&lt;`
testcase.rs:4     fn foo() -&gt; Option&lt;&lt;Self as Test&gt;::X&gt;;
                                    ^~
</code></pre></div>
<h3 dir="auto">STR</h3>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]

trait Trait {
    type Type;

    // OK
    fn method() -&gt; &lt;Self as Trait&gt;::Type;
    // Can't parse
    fn method() -&gt; Box&lt;&lt;Self as Trait&gt;::Type&gt;;
}

fn main() {}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>associated_types<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">trait</span> <span class="pl-smi">Trait</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">Type</span><span class="pl-kos">;</span>

    <span class="pl-c">// OK</span>
    <span class="pl-k">fn</span> <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; &lt;<span class="pl-smi">Self</span> <span class="pl-k">as</span> <span class="pl-smi">Trait</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">Type</span><span class="pl-kos">;</span>
    <span class="pl-c">// Can't parse</span>
    <span class="pl-k">fn</span> <span class="pl-en">method</span><span class="pl-kos">(</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Box</span><span class="pl-kos">&lt;</span>&lt;<span class="pl-smi">Self</span> <span class="pl-k">as</span> <span class="pl-smi">Trait</span>&gt;<span class="pl-kos">::</span><span class="pl-smi">Type</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">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span><span class="pl-kos">}</span></pre></div>
<h3 dir="auto">Output</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ai.rs:9:23: 9:25 error: expected `;` or `{`, found `&lt;&lt;`
ai.rs:9     fn method() -&gt; Box&lt;&lt;Self as Trait&gt;::Type&gt;;"><pre class="notranslate"><code class="notranslate">ai.rs:9:23: 9:25 error: expected `;` or `{`, found `&lt;&lt;`
ai.rs:9     fn method() -&gt; Box&lt;&lt;Self as Trait&gt;::Type&gt;;
</code></pre></div>
<h3 dir="auto">Version</h3>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="rustc 0.12.0-pre (9508faa22 2014-09-17 23:45:36 +0000)"><pre class="notranslate">rustc <span class="pl-c1">0.12</span><span class="pl-kos">.</span><span class="pl-c1">0</span>-<span class="pl-en">pre</span> <span class="pl-kos">(</span><span class="pl-c1">9508</span>faa22 <span class="pl-c1">2014</span>-<span class="pl-c1">09</span>-<span class="pl-c1">17</span> <span class="pl-c1">23</span><span class="pl-kos">:</span><span class="pl-c1">45</span><span class="pl-kos">:</span><span class="pl-c1">36</span> +<span class="pl-c1">0000</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">cc <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pcwalton/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pcwalton">@pcwalton</a></p>