<p dir="auto">While trying to compile some code that I have written, I ran into a compiler bug. I'm not really sure whats the issue so I don't know how to reduce the code size to a minimum test case. If you would like to see the code, its currently on the master branch in my repository and you can make it by having openssl on your computer and running</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="git clone --recursive http://github.com/jroweboy/oxidize
cd oxidize
./build-deps.sh
make lib"><pre class="notranslate"><code class="notranslate">git clone --recursive http://github.com/jroweboy/oxidize
cd oxidize
./build-deps.sh
make lib
</code></pre></div>
<p dir="auto">and at the end of that it produced the following error. This is the error message and dump provided by RUST_BACKTRACE=1</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: internal compiler error: Type metadata for ty::t '&amp;[core::fmt::rt::Piece&lt;&gt;]' is already in the TypeMap!
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:162

stack backtrace:
   1:     0x2b14e7292b00 - rt::backtrace::imp::write::h62d90560b5a07b07kXo::v0.11.0.pre
   2:     0x2b14e729a230 - failure::on_fail::ha470578b5eadf528Aip::v0.11.0.pre
   3:     0x2b14e6b199c0 - unwind::begin_unwind_inner::h1ffa5da7913ac170aTd::v0.11.0.pre
   4:     0x2b14e817a690 - unwind::begin_unwind::h9511542397565424626::v0.11.0.pre
   5:     0x2b14e817b0d0 - diagnostic::Handler::bug::hbf0741c8fa8e5c18c4b::v0.11.0.pre
   6:     0x2b14e414d790 - driver::session::Session::bug::hec7dc9574d5c6f2bK7p::v0.11.0.pre
   7:     0x2b14e429f900 - middle::trans::debuginfo::TypeMap::register_type_with_metadata::h55fc281d70ca2cb3KuB::v0.11.0.pre
   8:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
   9:     0x2b14e42b6be0 - middle::trans::debuginfo::MemberDescriptionFactory::create_member_descriptions::h0dade42805956a64y1C::v0.11.0.pre
  10:     0x2b14e42ba0d0 - middle::trans::debuginfo::RecursiveTypeDescription::finalize::h2927e9f899317398H3C::v0.11.0.pre
  11:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
  12:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
  13:     0x2b14e42c3470 - middle::trans::debuginfo::subroutine_type_metadata::ha5efe06324709ba2u2D::v0.11.0.pre
  14:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
  15:     0x2b14e4238780 - middle::trans::debuginfo::create_function_debug_context::h85b8bc85b6b4d219ilC::v0.11.0.pre
  16:     0x2b14e419efc0 - middle::trans::base::new_fn_ctxt::h6f536f0c03824a90nfq::v0.11.0.pre
  17:     0x2b14e423d610 - middle::trans::base::trans_closure::h5a95f13556af5a16stq::v0.11.0.pre
  18:     0x2b14e414e660 - middle::trans::base::trans_fn::h56028a210d10faa4vBq::v0.11.0.pre
  19:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  20:     0x2b14e417ced0 - middle::trans::controlflow::trans_stmt::h32f419d1ee2ab4e80gc::v0.11.0.pre
  21:     0x2b14e417eb80 - middle::trans::controlflow::trans_block::h2b5aa2711f6cc8cehmc::v0.11.0.pre
  22:     0x2b14e41bc7c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb3a3e913b96a67c2dsg::v0.11.0.pre
  23:     0x2b14e417e5e0 - middle::trans::expr::trans_into::h7892630deb269c36XAf::v0.11.0.pre
  24:     0x2b14e417eb80 - middle::trans::controlflow::trans_block::h2b5aa2711f6cc8cehmc::v0.11.0.pre
  25:     0x2b14e417efa0 - middle::trans::controlflow::trans_if::h1804ea536d6ebb0aVpc::v0.11.0.pre
  26:     0x2b14e41bc7c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb3a3e913b96a67c2dsg::v0.11.0.pre
  27:     0x2b14e417e5e0 - middle::trans::expr::trans_into::h7892630deb269c36XAf::v0.11.0.pre
  28:     0x2b14e417d8d0 - middle::trans::controlflow::trans_stmt_semi::hce4086c542079d72olc::v0.11.0.pre
  29:     0x2b14e417ced0 - middle::trans::controlflow::trans_stmt::h32f419d1ee2ab4e80gc::v0.11.0.pre
  30:     0x2b14e417eb80 - middle::trans::controlflow::trans_block::h2b5aa2711f6cc8cehmc::v0.11.0.pre
  31:     0x2b14e423d610 - middle::trans::base::trans_closure::h5a95f13556af5a16stq::v0.11.0.pre
  32:     0x2b14e414e660 - middle::trans::base::trans_fn::h56028a210d10faa4vBq::v0.11.0.pre
  33:     0x2b14e4243540 - middle::trans::meth::trans_impl::h41b46c355b036addkyw::v0.11.0.pre
  34:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  35:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  36:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  37:     0x2b14e424dc20 - middle::trans::base::trans_crate::h0bd47bf889551f0aALr::v0.11.0.pre
  38:     0x2b14e4a0e3e0 - driver::driver::phase_4_translate_to_llvm::hd23b79af21a985a6hip::v0.11.0.pre
  39:     0x2b14e4a02ba0 - driver::driver::compile_input::he8c688dd4bd2c23dJYo::v0.11.0.pre
  40:     0x2b14e4acd450 - driver::run_compiler::hc032cf39facd3bc7sEr::v0.11.0.pre
  41:     0x2b14e4acd360 - driver::main_args::closure.95811
  42:     0x2b14e4ae85b0 - driver::monitor::closure.96902
  43:     0x2b14e4ae34d0 - task::TaskBuilder::try::closure.96665
  44:     0x2b14e3bd2440 - task::spawn_opts::closure.7151
  45:     0x2b14e6b16570 - task::Task::run::closure.5308
  46:     0x2b14e6b819e0 - rust_try
  47:     0x2b14e6b18fb0 - unwind::try::hab2f48bb10975620wHd::v0.11.0.pre
  48:     0x2b14e6b163f0 - task::Task::run::hc231b1a0e6675f55HWc::v0.11.0.pre
  49:     0x2b14e3bd21e0 - task::spawn_opts::closure.7124
  50:     0x2b14e6b18580 - thread::thread_start::h9db5e56b1b03c62bbed::v0.11.0.pre
  51:     0x2b14e78d40c0 - start_thread
  52:     0x2b14e6f192d9 - __clone
  53:                0x0 - &lt;unknown&gt;"><pre class="notranslate"><code class="notranslate">error: internal compiler error: Type metadata for ty::t '&amp;[core::fmt::rt::Piece&lt;&gt;]' is already in the TypeMap!
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box&lt;Any&gt;', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:162

stack backtrace:
   1:     0x2b14e7292b00 - rt::backtrace::imp::write::h62d90560b5a07b07kXo::v0.11.0.pre
   2:     0x2b14e729a230 - failure::on_fail::ha470578b5eadf528Aip::v0.11.0.pre
   3:     0x2b14e6b199c0 - unwind::begin_unwind_inner::h1ffa5da7913ac170aTd::v0.11.0.pre
   4:     0x2b14e817a690 - unwind::begin_unwind::h9511542397565424626::v0.11.0.pre
   5:     0x2b14e817b0d0 - diagnostic::Handler::bug::hbf0741c8fa8e5c18c4b::v0.11.0.pre
   6:     0x2b14e414d790 - driver::session::Session::bug::hec7dc9574d5c6f2bK7p::v0.11.0.pre
   7:     0x2b14e429f900 - middle::trans::debuginfo::TypeMap::register_type_with_metadata::h55fc281d70ca2cb3KuB::v0.11.0.pre
   8:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
   9:     0x2b14e42b6be0 - middle::trans::debuginfo::MemberDescriptionFactory::create_member_descriptions::h0dade42805956a64y1C::v0.11.0.pre
  10:     0x2b14e42ba0d0 - middle::trans::debuginfo::RecursiveTypeDescription::finalize::h2927e9f899317398H3C::v0.11.0.pre
  11:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
  12:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
  13:     0x2b14e42c3470 - middle::trans::debuginfo::subroutine_type_metadata::ha5efe06324709ba2u2D::v0.11.0.pre
  14:     0x2b14e42acc20 - middle::trans::debuginfo::type_metadata::h99b1044c7787e9f1J6D::v0.11.0.pre
  15:     0x2b14e4238780 - middle::trans::debuginfo::create_function_debug_context::h85b8bc85b6b4d219ilC::v0.11.0.pre
  16:     0x2b14e419efc0 - middle::trans::base::new_fn_ctxt::h6f536f0c03824a90nfq::v0.11.0.pre
  17:     0x2b14e423d610 - middle::trans::base::trans_closure::h5a95f13556af5a16stq::v0.11.0.pre
  18:     0x2b14e414e660 - middle::trans::base::trans_fn::h56028a210d10faa4vBq::v0.11.0.pre
  19:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  20:     0x2b14e417ced0 - middle::trans::controlflow::trans_stmt::h32f419d1ee2ab4e80gc::v0.11.0.pre
  21:     0x2b14e417eb80 - middle::trans::controlflow::trans_block::h2b5aa2711f6cc8cehmc::v0.11.0.pre
  22:     0x2b14e41bc7c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb3a3e913b96a67c2dsg::v0.11.0.pre
  23:     0x2b14e417e5e0 - middle::trans::expr::trans_into::h7892630deb269c36XAf::v0.11.0.pre
  24:     0x2b14e417eb80 - middle::trans::controlflow::trans_block::h2b5aa2711f6cc8cehmc::v0.11.0.pre
  25:     0x2b14e417efa0 - middle::trans::controlflow::trans_if::h1804ea536d6ebb0aVpc::v0.11.0.pre
  26:     0x2b14e41bc7c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb3a3e913b96a67c2dsg::v0.11.0.pre
  27:     0x2b14e417e5e0 - middle::trans::expr::trans_into::h7892630deb269c36XAf::v0.11.0.pre
  28:     0x2b14e417d8d0 - middle::trans::controlflow::trans_stmt_semi::hce4086c542079d72olc::v0.11.0.pre
  29:     0x2b14e417ced0 - middle::trans::controlflow::trans_stmt::h32f419d1ee2ab4e80gc::v0.11.0.pre
  30:     0x2b14e417eb80 - middle::trans::controlflow::trans_block::h2b5aa2711f6cc8cehmc::v0.11.0.pre
  31:     0x2b14e423d610 - middle::trans::base::trans_closure::h5a95f13556af5a16stq::v0.11.0.pre
  32:     0x2b14e414e660 - middle::trans::base::trans_fn::h56028a210d10faa4vBq::v0.11.0.pre
  33:     0x2b14e4243540 - middle::trans::meth::trans_impl::h41b46c355b036addkyw::v0.11.0.pre
  34:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  35:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  36:     0x2b14e4147d60 - middle::trans::base::trans_item::h981baeea4b2d0e69XRq::v0.11.0.pre
  37:     0x2b14e424dc20 - middle::trans::base::trans_crate::h0bd47bf889551f0aALr::v0.11.0.pre
  38:     0x2b14e4a0e3e0 - driver::driver::phase_4_translate_to_llvm::hd23b79af21a985a6hip::v0.11.0.pre
  39:     0x2b14e4a02ba0 - driver::driver::compile_input::he8c688dd4bd2c23dJYo::v0.11.0.pre
  40:     0x2b14e4acd450 - driver::run_compiler::hc032cf39facd3bc7sEr::v0.11.0.pre
  41:     0x2b14e4acd360 - driver::main_args::closure.95811
  42:     0x2b14e4ae85b0 - driver::monitor::closure.96902
  43:     0x2b14e4ae34d0 - task::TaskBuilder::try::closure.96665
  44:     0x2b14e3bd2440 - task::spawn_opts::closure.7151
  45:     0x2b14e6b16570 - task::Task::run::closure.5308
  46:     0x2b14e6b819e0 - rust_try
  47:     0x2b14e6b18fb0 - unwind::try::hab2f48bb10975620wHd::v0.11.0.pre
  48:     0x2b14e6b163f0 - task::Task::run::hc231b1a0e6675f55HWc::v0.11.0.pre
  49:     0x2b14e3bd21e0 - task::spawn_opts::closure.7124
  50:     0x2b14e6b18580 - thread::thread_start::h9db5e56b1b03c62bbed::v0.11.0.pre
  51:     0x2b14e78d40c0 - start_thread
  52:     0x2b14e6f192d9 - __clone
  53:                0x0 - &lt;unknown&gt;
</code></pre></div>
<p dir="auto">Compiling libcore with -g leads to the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: internal compiler error: Type metadata for ty::t '&amp;[core::fmt::rt::Piece&lt;&gt;]' is already in the TypeMap!"><pre class="notranslate"><code class="notranslate">error: internal compiler error: Type metadata for ty::t '&amp;[core::fmt::rt::Piece&lt;&gt;]' is already in the TypeMap!
</code></pre></div>
<p dir="auto">This is due to the vec slice in question occurring multiple times along a type reference chain and the code path for vec slices doesn't take that possibility into account. This is also a potential problem for other kinds of types, e.g. fixed length vector types or function types. For regular pointer types this is already handled correctly.</p>