<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rustc 0.13.0-dev (fac5a0767 2014-11-26 22:37:06 +0000)
binary: rustc
commit-hash: fac5a07679cac21a580badc84b755b8df0f975cf
commit-date: 2014-11-26 22:37:06 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev"><pre class="notranslate"><code class="notranslate">rustc 0.13.0-dev (fac5a0767 2014-11-26 22:37:06 +0000)
binary: rustc
commit-hash: fac5a07679cac21a580badc84b755b8df0f975cf
commit-date: 2014-11-26 22:37:06 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev
</code></pre></div>
<p dir="auto">On this build, I'm seeing cargo successfully compile such a plugin without any error message. Crates that attempt to load the plugin then fail with a confusing "undefined symbol" error, which provides little assistance in locating the root of the problem.</p>
<p dir="auto">I suggest that such a plugin should not even compile.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mod Foo { fn x() {} }

struct Foo;

impl Foo { fn y() {} }

fn main() {}"><pre class="notranslate"><span class="pl-k">mod</span> <span class="pl-v">Foo</span> <span class="pl-kos">{</span> <span class="pl-k">fn</span> <span class="pl-en">x</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>

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

<span class="pl-k">impl</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span> <span class="pl-k">fn</span> <span class="pl-en">y</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>

<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;:5:1: 5:23 error: duplicate definition of module `Foo`
&lt;anon&gt;:5 impl Foo { fn y() {} }
         ^~~~~~~~~~~~~~~~~~~~~~
&lt;anon&gt;:3:1: 3:12 note: first definition of module `Foo` here
&lt;anon&gt;:3 struct Foo;
         ^~~~~~~~~~~
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:5:1: 5:23 error: duplicate definition of module `Foo`
&lt;anon&gt;:5 impl Foo { fn y() {} }
         ^~~~~~~~~~~~~~~~~~~~~~
&lt;anon&gt;:3:1: 3:12 note: first definition of module `Foo` here
&lt;anon&gt;:3 struct Foo;
         ^~~~~~~~~~~
error: aborting due to previous error
</code></pre></div>
<p dir="auto">The "first definition" error should be pointing to the <code class="notranslate">mod Foo</code>.</p>