<p dir="auto">The following code compiles with no warning or error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="enum x {}

enum y { x }

fn main() {}"><pre class="notranslate"><code class="notranslate">enum x {}

enum y { x }

fn main() {}
</code></pre></div>
<p dir="auto">However if the positions of the enums are reversed then the compile fails with a (I think bogus) error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="enum y { x }

enum x {}

fn main() {}"><pre class="notranslate"><code class="notranslate">enum y { x }

enum x {}

fn main() {}
</code></pre></div>
<p dir="auto">The error message is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="test.rs:5:0: 5:9 error: Duplicate definition of value x
test.rs:5 enum x {}
          ^~~~~~~~~
test.rs:3:9: 3:10 note: First definition of value x here:
test.rs:3 enum y { x }
                   ^
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">test.rs:5:0: 5:9 error: Duplicate definition of value x
test.rs:5 enum x {}
          ^~~~~~~~~
test.rs:3:9: 3:10 note: First definition of value x here:
test.rs:3 enum y { x }
                   ^
error: aborting due to previous error
</code></pre></div>
<p dir="auto">Affects all attempts to build the compiler from revision <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/98d4d4997e300bb712254a67184caf8892af4be0/hovercard" href="https://github.com/rust-lang/rust/commit/98d4d4997e300bb712254a67184caf8892af4be0"><tt>98d4d49</tt></a> (with snapshot <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/9e4e524e0eb17c8f463e731f23b544003e8709c6/hovercard" href="https://github.com/rust-lang/rust/commit/9e4e524e0eb17c8f463e731f23b544003e8709c6"><tt>9e4e524</tt></a>) forward. Last "good" release was <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/rust-lang/rust/commit/87dce0c138af6887704fc2379b7a75e05a1e8b18/hovercard" href="https://github.com/rust-lang/rust/commit/87dce0c138af6887704fc2379b7a75e05a1e8b18"><tt>87dce0c</tt></a>.</p>
<p dir="auto">Build output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CFG_LLVM_LINKAGE_FILE=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/rt/llvmdeps.rs LD_LIBRARY_PATH=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/stage1/lib:$LD_LIBRARY_PATH   x86_64-unknown-freebsd/stage1/bin/rustc --cfg stage1  -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-freebsd  -D warnings -L &quot;x86_64-unknown-freebsd/rt&quot; -L &quot;/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/llvm/Release+Asserts/lib&quot; -L &quot;&quot;  --out-dir x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib -C extra-filename=-4e7c5e5c /home/aidan/rust/rust2/rust/src/libcore/lib.rs
/home/aidan/rust/rust2/rust/mk/target.mk:165: recipe for target 'x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib/stamp.core' failed
gmake: *** [x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib/stamp.core] Segmentation fault: 11"><pre class="notranslate"><code class="notranslate">CFG_LLVM_LINKAGE_FILE=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/rt/llvmdeps.rs LD_LIBRARY_PATH=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/stage1/lib:$LD_LIBRARY_PATH   x86_64-unknown-freebsd/stage1/bin/rustc --cfg stage1  -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-freebsd  -D warnings -L "x86_64-unknown-freebsd/rt" -L "/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/llvm/Release+Asserts/lib" -L ""  --out-dir x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib -C extra-filename=-4e7c5e5c /home/aidan/rust/rust2/rust/src/libcore/lib.rs
/home/aidan/rust/rust2/rust/mk/target.mk:165: recipe for target 'x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib/stamp.core' failed
gmake: *** [x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib/stamp.core] Segmentation fault: 11
</code></pre></div>
<p dir="auto">When compiling with this command line:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="RUST_LOG=debug CFG_LLVM_LINKAGE_FILE=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/rt/llvmdeps.rs LD_LIBRARY_PATH=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/stage1/lib:$LD_LIBRARY_PATH   x86_64-unknown-freebsd/stage1/bin/rustc --cfg stage1  -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-freebsd  -D warnings -L &quot;x86_64-unknown-freebsd/rt&quot; -L &quot;/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/llvm/Release+Asserts/lib&quot; -L &quot;&quot;  --out-dir x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib -C extra-filename=-4e7c5e5c -Z time-passes /home/aidan/rust/rust2/rust/src/libcore/lib.rs"><pre class="notranslate"><code class="notranslate">RUST_LOG=debug CFG_LLVM_LINKAGE_FILE=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/rt/llvmdeps.rs LD_LIBRARY_PATH=/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/stage1/lib:$LD_LIBRARY_PATH   x86_64-unknown-freebsd/stage1/bin/rustc --cfg stage1  -O --cfg rtopt --cfg debug -C prefer-dynamic --target=x86_64-unknown-freebsd  -D warnings -L "x86_64-unknown-freebsd/rt" -L "/usr/home/aidan/rust/rust2/rust/x86_64-unknown-freebsd/llvm/Release+Asserts/lib" -L ""  --out-dir x86_64-unknown-freebsd/stage1/lib/rustlib/x86_64-unknown-freebsd/lib -C extra-filename=-4e7c5e5c -Z time-passes /home/aidan/rust/rust2/rust/src/libcore/lib.rs
</code></pre></div>
<p dir="auto">Yields <a href="http://pastebin.mozilla.org/8382984" rel="nofollow">this debug log tail</a></p>
<p dir="auto">Ran configure as:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="./configure --disable-jemalloc --prefix=/pkg/rust2 --local-rust-root=/pkg/rust2 --libdir=/pkg/rust2/lib --enable-debug"><pre class="notranslate"><code class="notranslate">./configure --disable-jemalloc --prefix=/pkg/rust2 --local-rust-root=/pkg/rust2 --libdir=/pkg/rust2/lib --enable-debug
</code></pre></div>
<p dir="auto">uname -a output (not that it should matter much):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="FreeBSD freebsd 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r+2315ea3: Fri Dec 20 12:48:50 PST 2013     root@build.ixsystems.com:/tank/home/jkh/checkout/freenas/os-base/amd64/tank/home/jkh/checkout/freenas/FreeBSD/src/sys/FREENAS.amd64  amd64"><pre class="notranslate"><code class="notranslate">FreeBSD freebsd 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r+2315ea3: Fri Dec 20 12:48:50 PST 2013     root@build.ixsystems.com:/tank/home/jkh/checkout/freenas/os-base/amd64/tank/home/jkh/checkout/freenas/FreeBSD/src/sys/FREENAS.amd64  amd64
</code></pre></div>
<p dir="auto">(Note that I've updated the base FreeBSD installation to run w/ clang instead of gcc.)</p>
<p dir="auto">Builds and runs fine when jemalloc is enabled, but if we assume the system allocator works, it would mean there's a bug somewhere in rustc's (or llvm's) code generation: some investigation showed the segfault occurred due to memory corruption in the AST. I suspect this problem will be reproducable with FreeBSD 10.</p>