<p dir="auto">Borrowing a unique pointer temporarily invalidates its type (the pointer is no longer unique).  We need to ensure that the original unique pointer is inaccessible while the borrow alias exists (except, possibly to create other borrows).  This will be done in a separate pass (I've actually implemented most of the code as part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3766098" data-permission-text="Title is private" data-url="https://github.com/rust-lang/rust/issues/2046" data-hovercard-type="issue" data-hovercard-url="/rust-lang/rust/issues/2046/hovercard" href="https://github.com/rust-lang/rust/issues/2046">#2046</a>) which will check when a <code class="notranslate">~T</code> is borrowed that either:</p>
<ol dir="auto">
<li>the borrowee is an rvalue, in which case the only accessible copy is the borrowed ptr and everything is fine.</li>
<li>the borrowee is an lvalue that is rooted in a local variable. This local variable is then made inaccessible for the scope of the borrow.</li>
</ol>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(associated_types)]

trait Wub {
    type Zoop;
}

trait Flim: Wub {}

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">Wub</span> <span class="pl-kos">{</span>
    <span class="pl-k">type</span> <span class="pl-smi">Zoop</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">trait</span> <span class="pl-smi">Flim</span><span class="pl-kos">:</span> <span class="pl-smi">Wub</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>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:7:13: 7:16 error: associated types may not be referenced here
&lt;anon&gt;:7 trait Flim: Wub {}
                     ^~~"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:7:13: 7:16 error: associated types may not be referenced here
&lt;anon&gt;:7 trait Flim: Wub {}
                     ^~~
</code></pre></div>