<p dir="auto">Users who want a macro that expands to a collection items are required to wrap the RHS in <code class="notranslate">{}</code> in order to get them to expand to a whole block. However, if they fail to do so, they unexpectedly just get the first item of the block, rather than an error message.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="macro_rules! print_if_nonzero(
    ($msg:expr, $($field:ident),*) =&gt; ( /*{*/
        $(
            if t.$field != 0 {
                println($msg);
            }
        )*
    /*}*/ )
)

struct T { x: int, y: int }

fn main() {
    let t = T { x: 0, y: 0 };
    print_if_nonzero!(&quot;hello&quot;, x, y);
}"><pre class="notranslate"><span class="pl-k">macro_rules!</span> print_if_nonzero<span class="pl-kos">(</span>
    <span class="pl-kos">(</span>$msg<span class="pl-kos">:</span>expr, $<span class="pl-kos">(</span>$field<span class="pl-kos">:</span>ident<span class="pl-kos">)</span>,<span class="pl-c1">*</span><span class="pl-kos">)</span> =&gt; <span class="pl-kos">(</span> <span class="pl-c">/*{*/</span>
        $<span class="pl-kos">(</span>
            <span class="pl-k">if</span> t.$field != <span class="pl-c1">0</span> <span class="pl-kos">{</span>
                println<span class="pl-kos">(</span>$msg<span class="pl-kos">)</span>;
            <span class="pl-kos">}</span>
        <span class="pl-kos">)</span><span class="pl-c1">*</span>
    <span class="pl-c">/*}*/</span> <span class="pl-kos">)</span>
<span class="pl-kos">)</span><span class="pl-kos"></span>

<span class="pl-k">struct</span> <span class="pl-smi">T</span> <span class="pl-kos">{</span> <span class="pl-c1">x</span><span class="pl-kos">:</span> <span class="pl-smi">int</span><span class="pl-kos">,</span> <span class="pl-c1">y</span><span class="pl-kos">:</span> <span class="pl-smi">int</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> t = <span class="pl-smi">T</span> <span class="pl-kos">{</span> <span class="pl-c1">x</span><span class="pl-kos">:</span> <span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-c1">y</span><span class="pl-kos">:</span> <span class="pl-c1">0</span> <span class="pl-kos">}</span><span class="pl-kos">;</span>
    <span class="pl-en">print_if_nonzero</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"hello"</span>, x, y<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">...expands to...</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="fn main() { let t = T{x: 0, y: 0,}; if t.x != 0 { println(&quot;hello&quot;); }; }"><pre class="notranslate"><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> t = <span class="pl-smi">T</span><span class="pl-kos">{</span><span class="pl-c1">x</span><span class="pl-kos">:</span> <span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-c1">y</span><span class="pl-kos">:</span> <span class="pl-c1">0</span><span class="pl-kos">,</span><span class="pl-kos">}</span><span class="pl-kos">;</span> <span class="pl-k">if</span> t<span class="pl-kos">.</span><span class="pl-c1">x</span> != <span class="pl-c1">0</span> <span class="pl-kos">{</span> <span class="pl-en">println</span><span class="pl-kos">(</span><span class="pl-s">"hello"</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-kos">}</span><span class="pl-kos">;</span> <span class="pl-kos">}</span></pre></div>
<p dir="auto">When two items in the same documentation page have the same name, rustdoc generates duplicate HTML <code class="notranslate">id</code> attributes for them. This makes the HTML invalid, but more importantly, it makes it impossible to link to anything but the one that shows up first in the source.</p>
<p dir="auto">For example, <a href="http://doc.rust-lang.org/nightly/std/vec/struct.Vec.html" rel="nofollow"><code class="notranslate">Vec</code>'s page</a> contains multiple impls of <code class="notranslate">IntoIterator</code>, and therefore multiple HTML elements that have an <code class="notranslate">id</code> attribute of <code class="notranslate">assoc_type.Item</code>, <code class="notranslate">assoc_type.IntoIter</code>, and <code class="notranslate">method.into_iter</code>.</p>
<p dir="auto">This is not limited to impls of the same trait, as different traits (and inherent impls) could define methods or associated types with the same name.</p>