<p dir="auto">When implementing <code class="notranslate">Drop</code> on a type that has type parameters (which requires <code class="notranslate">#[unsafe_destructor])</code>, if the <code class="notranslate">Drop</code> impl is specialized to some concrete type parameter, the specialization is ignored in the drop glue and the <code class="notranslate">Drop</code> impl is instead run on all values of the outer type regardless of type parameters.</p>
<p dir="auto">Example:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(unsafe_destructor)]

extern crate debug;

struct DropMe&lt;T&gt; {
    _x: T
}

struct ImplDrop;

#[unsafe_destructor]
impl Drop for DropMe&lt;ImplDrop&gt; {
    fn drop(&amp;mut self) {
        println!(&quot;DropMe&lt;ImplDrop&gt;.Drop: {:?}&quot;, *self);
    }
}

fn main() {
    let x = DropMe::&lt;ImplDrop&gt; { _x: ImplDrop };
    println!(&quot;Dropping DropMe&lt;ImplDrop&gt;&quot;);
    drop(x);

    let y = DropMe::&lt;int&gt; { _x: 32 };
    println!(&quot;Dropping DropMe&lt;int&gt;&quot;);
    drop(y);
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>unsafe_destructor<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">extern</span> <span class="pl-k">crate</span> debug<span class="pl-kos">;</span>

<span class="pl-k">struct</span> <span class="pl-smi">DropMe</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-c1">_x</span><span class="pl-kos">:</span> <span class="pl-smi">T</span>
<span class="pl-kos">}</span>

<span class="pl-k">struct</span> <span class="pl-smi">ImplDrop</span><span class="pl-kos">;</span>

<span class="pl-c1">#<span class="pl-kos">[</span>unsafe_destructor<span class="pl-kos">]</span></span>
<span class="pl-k">impl</span> <span class="pl-smi">Drop</span> <span class="pl-k">for</span> <span class="pl-smi">DropMe</span><span class="pl-kos">&lt;</span><span class="pl-smi">ImplDrop</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">drop</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"DropMe&lt;ImplDrop&gt;.Drop: {:?}"</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">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-k">let</span> x = <span class="pl-smi">DropMe</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">ImplDrop</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">_x</span><span class="pl-kos">:</span> <span class="pl-v">ImplDrop</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Dropping DropMe&lt;ImplDrop&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">drop</span><span class="pl-kos">(</span>x<span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">let</span> y = <span class="pl-smi">DropMe</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">_x</span><span class="pl-kos">:</span> <span class="pl-c1">32</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Dropping DropMe&lt;int&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">drop</span><span class="pl-kos">(</span>y<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This should print</p>
<blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Dropping DropMe&lt;int&gt;
Dropping DropMe&lt;ImplDrop&gt;
DropMe&lt;ImplDrop&gt;.Drop: DropMe&lt;ImplDrop&gt;{_x: ImplDrop}"><pre class="notranslate"><code class="notranslate">Dropping DropMe&lt;int&gt;
Dropping DropMe&lt;ImplDrop&gt;
DropMe&lt;ImplDrop&gt;.Drop: DropMe&lt;ImplDrop&gt;{_x: ImplDrop}
</code></pre></div>
</blockquote>
<p dir="auto">Instead it prints</p>
<blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Dropping DropMe&lt;int&gt;
DropMe&lt;ImplDrop&gt;.Drop: DropMe&lt;ImplDrop&gt;{_x: ImplDrop}
Dropping DropMe&lt;ImplDrop&gt;
DropMe&lt;ImplDrop&gt;.Drop: DropMe&lt;ImplDrop&gt;{_x: ImplDrop}"><pre class="notranslate"><code class="notranslate">Dropping DropMe&lt;int&gt;
DropMe&lt;ImplDrop&gt;.Drop: DropMe&lt;ImplDrop&gt;{_x: ImplDrop}
Dropping DropMe&lt;ImplDrop&gt;
DropMe&lt;ImplDrop&gt;.Drop: DropMe&lt;ImplDrop&gt;{_x: ImplDrop}
</code></pre></div>
</blockquote>
<p dir="auto">Note that it's calling the <code class="notranslate">Drop</code> impl on <code class="notranslate">DropMe&lt;int&gt;</code>, even though the <code class="notranslate">Drop</code> impl itself believes that the receiver type is <code class="notranslate">DropMe&lt;ImplDrop&gt;</code>.</p>
<hr>
<p dir="auto">It gets worse. If you add a second specialized <code class="notranslate">Drop</code> impl, that completely overrides the first:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(unsafe_destructor)]

extern crate debug;

struct DropMe&lt;T&gt; {
    _x: T
}

struct ImplDrop;

#[unsafe_destructor]
impl Drop for DropMe&lt;ImplDrop&gt; {
    fn drop(&amp;mut self) {
        println!(&quot;DropMe&lt;ImplDrop&gt;.Drop: {:?}&quot;, *self);
    }
}

#[unsafe_destructor]
impl Drop for DropMe&lt;int&gt; {
    fn drop(&amp;mut self) {
        println!(&quot;DropMe&lt;int&gt;.Drop: {:?}&quot;, *self);
    }
}

fn main() {
    let x = DropMe::&lt;int&gt; { _x: 32 };
    println!(&quot;Dropping DropMe&lt;int&gt;&quot;);
    drop(x);

    let y = DropMe::&lt;ImplDrop&gt; { _x: ImplDrop };
    println!(&quot;Dropping DropMe&lt;ImplDrop&gt;&quot;);
    drop(y);
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>unsafe_destructor<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">extern</span> <span class="pl-k">crate</span> debug<span class="pl-kos">;</span>

<span class="pl-k">struct</span> <span class="pl-smi">DropMe</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-c1">_x</span><span class="pl-kos">:</span> <span class="pl-smi">T</span>
<span class="pl-kos">}</span>

<span class="pl-k">struct</span> <span class="pl-smi">ImplDrop</span><span class="pl-kos">;</span>

<span class="pl-c1">#<span class="pl-kos">[</span>unsafe_destructor<span class="pl-kos">]</span></span>
<span class="pl-k">impl</span> <span class="pl-smi">Drop</span> <span class="pl-k">for</span> <span class="pl-smi">DropMe</span><span class="pl-kos">&lt;</span><span class="pl-smi">ImplDrop</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">drop</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"DropMe&lt;ImplDrop&gt;.Drop: {:?}"</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-c1">#<span class="pl-kos">[</span>unsafe_destructor<span class="pl-kos">]</span></span>
<span class="pl-k">impl</span> <span class="pl-smi">Drop</span> <span class="pl-k">for</span> <span class="pl-smi">DropMe</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">fn</span> <span class="pl-en">drop</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"DropMe&lt;int&gt;.Drop: {:?}"</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">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-k">let</span> x = <span class="pl-smi">DropMe</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">_x</span><span class="pl-kos">:</span> <span class="pl-c1">32</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Dropping DropMe&lt;int&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">drop</span><span class="pl-kos">(</span>x<span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">let</span> y = <span class="pl-smi">DropMe</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">ImplDrop</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">_x</span><span class="pl-kos">:</span> <span class="pl-v">ImplDrop</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Dropping DropMe&lt;ImplDrop&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">drop</span><span class="pl-kos">(</span>y<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This prints:</p>
<blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Dropping DropMe&lt;int&gt;
DropMe&lt;int&gt;.Drop: DropMe&lt;int&gt;{_x: 32}
Dropping DropMe&lt;ImplDrop&gt;
DropMe&lt;int&gt;.Drop: DropMe&lt;int&gt;{_x: 140734783283201}"><pre class="notranslate"><code class="notranslate">Dropping DropMe&lt;int&gt;
DropMe&lt;int&gt;.Drop: DropMe&lt;int&gt;{_x: 32}
Dropping DropMe&lt;ImplDrop&gt;
DropMe&lt;int&gt;.Drop: DropMe&lt;int&gt;{_x: 140734783283201}
</code></pre></div>
</blockquote>
<hr>
<p dir="auto">It gets worse. If you use a type parameter with bounds, it incorrectly believes that it needs to call the <code class="notranslate">Drop</code> impl regardless of parameterization (as it did before), even though it knows that the type doesn't conform to the bounds. At least this time it's a compile-time error:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(unsafe_destructor)]

extern crate debug;

struct DropMe&lt;T&gt; {
    _x: T
}

struct ImplDrop;
trait Foo {}
impl Foo for ImplDrop {}

#[unsafe_destructor]
impl&lt;T: Foo&gt; Drop for DropMe&lt;T&gt; {
    fn drop(&amp;mut self) {
        println!(&quot;DropMe&lt;T: Foo&gt;.Drop: {:?}&quot;, *self);
    }
}

fn main() {
    let x = DropMe::&lt;int&gt; { _x: 32 };
    println!(&quot;Dropping DropMe&lt;int&gt;&quot;);
    drop(x);

    let y = DropMe::&lt;ImplDrop&gt; { _x: ImplDrop };
    println!(&quot;Dropping DropMe&lt;ImplDrop&gt;&quot;);
    drop(y);
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>unsafe_destructor<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">extern</span> <span class="pl-k">crate</span> debug<span class="pl-kos">;</span>

<span class="pl-k">struct</span> <span class="pl-smi">DropMe</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-c1">_x</span><span class="pl-kos">:</span> <span class="pl-smi">T</span>
<span class="pl-kos">}</span>

<span class="pl-k">struct</span> <span class="pl-smi">ImplDrop</span><span class="pl-kos">;</span>
<span class="pl-k">trait</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>
<span class="pl-k">impl</span> <span class="pl-smi">Foo</span> <span class="pl-k">for</span> <span class="pl-smi">ImplDrop</span> <span class="pl-kos">{</span><span class="pl-kos">}</span>

<span class="pl-c1">#<span class="pl-kos">[</span>unsafe_destructor<span class="pl-kos">]</span></span>
<span class="pl-k">impl</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">:</span> <span class="pl-smi">Foo</span><span class="pl-kos">&gt;</span> <span class="pl-smi">Drop</span> <span class="pl-k">for</span> <span class="pl-smi">DropMe</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">drop</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">self</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"DropMe&lt;T: Foo&gt;.Drop: {:?}"</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">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-k">let</span> x = <span class="pl-smi">DropMe</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">_x</span><span class="pl-kos">:</span> <span class="pl-c1">32</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Dropping DropMe&lt;int&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">drop</span><span class="pl-kos">(</span>x<span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-k">let</span> y = <span class="pl-smi">DropMe</span><span class="pl-kos">::</span><span class="pl-kos">&lt;</span><span class="pl-smi">ImplDrop</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span> <span class="pl-c1">_x</span><span class="pl-kos">:</span> <span class="pl-v">ImplDrop</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"Dropping DropMe&lt;ImplDrop&gt;"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">drop</span><span class="pl-kos">(</span>y<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<blockquote>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="unnamed.rs:15:5: 17:6 error: failed to find an implementation of trait Foo for int
unnamed.rs:15     fn drop(&amp;mut self) {
unnamed.rs:16         println!(&quot;DropMe&lt;T: Foo&gt;.Drop: {:?}&quot;, *self);
unnamed.rs:17     }"><pre class="notranslate"><code class="notranslate">unnamed.rs:15:5: 17:6 error: failed to find an implementation of trait Foo for int
unnamed.rs:15     fn drop(&amp;mut self) {
unnamed.rs:16         println!("DropMe&lt;T: Foo&gt;.Drop: {:?}", *self);
unnamed.rs:17     }
</code></pre></div>
</blockquote>
<p dir="auto">And of course if you add an <code class="notranslate">impl Drop for DropMe&lt;int&gt;</code> then it complains about duplicate implementations.</p>
<p dir="auto">E.g. a <a href="http://doc.rust-lang.org/std/?search=trait%3A%20Eq" rel="nofollow">search for <code class="notranslate">trait: Eq</code></a> is rendered in the URL as <a href="http://doc.rust-lang.org/std/?search=Eq" rel="nofollow">a plain <code class="notranslate">Eq</code> search</a>. Theoretically the <code class="notranslate">search</code> parameter should be in 1-1 correspondence with the actual searches (e.g. just encoding the raw contents of the search box would be fine).</p>