<p dir="auto">It shouldn't be.</p>
<p dir="auto">On playpen nightly</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![crate_type=&quot;lib&quot;]
#![feature(asm)]

fn main() {
    unsafe {
        routine()
    }
}

pub unsafe fn routine() {
    asm!(&quot;mov ecx, 0xFF
          .loop:
          loop .loop&quot;
          : // no outputs
          : // no inputs
          : &quot;ecx&quot;
          : &quot;intel&quot;);
}

pub unsafe fn routine2() {
    routine(); // causes inlining, duplicating the symbol improperly
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>crate_type=<span class="pl-s">"lib"</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>asm<span class="pl-kos">)</span><span class="pl-kos">]</span></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">unsafe</span> <span class="pl-kos">{</span>
        <span class="pl-en">routine</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">pub</span> <span class="pl-k">unsafe</span> <span class="pl-k">fn</span> <span class="pl-en">routine</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">asm</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"mov ecx, 0xFF</span>
<span class="pl-s">          .loop:</span>
<span class="pl-s">          loop .loop"</span>
          : <span class="pl-c">// no outputs</span>
          : <span class="pl-c">// no inputs</span>
          : <span class="pl-s">"ecx"</span>
          : <span class="pl-s">"intel"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">pub</span> <span class="pl-k">unsafe</span> <span class="pl-k">fn</span> <span class="pl-en">routine2</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-en">routine</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span> <span class="pl-c">// causes inlining, duplicating the symbol improperly</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;:11:5: 17:22 error: &lt;inline asm&gt;:3:11: error: invalid symbol redefinition
          .loop:
          ^

&lt;anon&gt;:11     asm!(&quot;mov cx, 0xFF
&lt;anon&gt;:12           .loop:
&lt;anon&gt;:13           loop .loop&quot;
&lt;anon&gt;:14           : // no outputs
&lt;anon&gt;:15           : // no inputs
&lt;anon&gt;:16           : &quot;ecx&quot;
          ...
error: aborting due to previous error
playpen: application terminated with error code 101"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:11:5: 17:22 error: &lt;inline asm&gt;:3:11: error: invalid symbol redefinition
          .loop:
          ^

&lt;anon&gt;:11     asm!("mov cx, 0xFF
&lt;anon&gt;:12           .loop:
&lt;anon&gt;:13           loop .loop"
&lt;anon&gt;:14           : // no outputs
&lt;anon&gt;:15           : // no inputs
&lt;anon&gt;:16           : "ecx"
          ...
error: aborting due to previous error
playpen: application terminated with error code 101
</code></pre></div>
<p dir="auto">The following two conditions are necessary to trigger this:</p>
<ul dir="auto">
<li>Generating a library ( <code class="notranslate">#![crate_type="lib"]</code> )</li>
<li>At least <code class="notranslate">-C opt-level=2</code></li>
</ul>
<p dir="auto">Without both of these, the error does not occur.</p>