<p dir="auto">My Travis CI builds started failing yesterday for a few very simple programs.  Here's a sample:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="use std::os;

fn fact(n: int) -&gt; int {
    let mut result = 1;
    let mut i = 1;
    while i &lt;= n {
        result *= i;
        i += 1;
    }

    result
}

fn main() {
    let args = os::args();
    if args.len() &gt;= 2 {
        let val = match from_str::&lt;int&gt;(args.get(1).as_slice()) {
            Some(n) =&gt; { n}
            _ =&gt; {
                fail!(&quot;n must be an integer&quot;);
            }
        };

        let val= fact(val);
        println!(&quot;{}&quot;, val);
    }
    else {
        println!(&quot;Usage: {} n&quot;, args.get(0));
    }
}"><pre class="notranslate"><code class="notranslate">use std::os;

fn fact(n: int) -&gt; int {
    let mut result = 1;
    let mut i = 1;
    while i &lt;= n {
        result *= i;
        i += 1;
    }

    result
}

fn main() {
    let args = os::args();
    if args.len() &gt;= 2 {
        let val = match from_str::&lt;int&gt;(args.get(1).as_slice()) {
            Some(n) =&gt; { n}
            _ =&gt; {
                fail!("n must be an integer");
            }
        };

        let val= fact(val);
        println!("{}", val);
    }
    else {
        println!("Usage: {} n", args.get(0));
    }
}
</code></pre></div>
<p dir="auto">Here's the compiler version I'm using:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ rustc --version
rustc 0.11.0-pre (d64f18c 2014-06-14 10:36:46 +0000)
host: x86_64-unknown-linux-gnu"><pre class="notranslate"><code class="notranslate">$ rustc --version
rustc 0.11.0-pre (d64f18c 2014-06-14 10:36:46 +0000)
host: x86_64-unknown-linux-gnu
</code></pre></div>
<p dir="auto">Here's the output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ RUST_BACKTRACE=1 make
rustc -L . -O -g fact.rs
error: internal compiler error: Type metadata for unique id '{&amp;{&amp;[]{struct c5265340fd5e95cf/2157e}}}' 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/a_m0d/workspace/rust/rust-git/src/libsyntax/diagnostic.rs:162

stack backtrace:
   1:     0x7fd483b46b10 - rt::backtrace::imp::write::hcabbaed93b4a98e5BGp::v0.11.0.pre
   2:     0x7fd483b4e240 - failure::on_fail::hbb978a5d8c60ba05O1p::v0.11.0.pre
   3:     0x7fd483f5ebd0 - unwind::begin_unwind_inner::h44989725a2971cebQRd::v0.11.0.pre
   4:     0x7fd482e3ba10 - unwind::begin_unwind::h14189599302266478606::v0.11.0.pre
   5:     0x7fd482e3c450 - diagnostic::Handler::bug::h7c581c7c950ff91bW3b::v0.11.0.pre
   6:     0x7fd4845c2a20 - driver::session::Session::bug::h0b37439c222facdbMkw::v0.11.0.pre
   7:     0x7fd48471efd0 - middle::trans::debuginfo::TypeMap::register_unique_id_with_metadata::hd285f7ffd8d40948YpB::v0.11.0.pre
   8:     0x7fd48472ad40 - middle::trans::debuginfo::type_metadata::h7e40fd5de8f2084c1ZD::v0.11.0.pre
   9:     0x7fd48472fa00 - middle::trans::debuginfo::declare_local::h2ef60ae7ae4e79152DC::v0.11.0.pre
  10:     0x7fd48472ed20 - middle::trans::debuginfo::create_local_var_metadata::closure.68299
  11:     0x7fd484b247c0 - middle::pat_util::pat_bindings::closure.80677
  12:     0x7fd482e83580 - ast_util::walk_pat::h986992b8f14168226Du::v0.11.0.pre
  13:     0x7fd4845f3420 - middle::trans::controlflow::trans_stmt::h24d6d571b97ebc4aKdc::v0.11.0.pre
  14:     0x7fd4845f50d0 - middle::trans::controlflow::trans_block::h591e39dcfd941e5e0ic::v0.11.0.pre
  15:     0x7fd4846374c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb6a52facd2ebe117umg::v0.11.0.pre
  16:     0x7fd4845f4b30 - middle::trans::expr::trans_into::hf6cfd7b67570103dpvf::v0.11.0.pre
  17:     0x7fd48464b410 - middle::trans::_match::trans_match::h32a62d3fd67945c7Kmu::v0.11.0.pre
  18:     0x7fd4846374c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb6a52facd2ebe117umg::v0.11.0.pre
  19:     0x7fd4845f4b30 - middle::trans::expr::trans_into::hf6cfd7b67570103dpvf::v0.11.0.pre
  20:     0x7fd4845f3e20 - middle::trans::controlflow::trans_stmt_semi::he15d494a96ca551a7hc::v0.11.0.pre
  21:     0x7fd4845f3420 - middle::trans::controlflow::trans_stmt::h24d6d571b97ebc4aKdc::v0.11.0.pre
  22:     0x7fd4845f50d0 - middle::trans::controlflow::trans_block::h591e39dcfd941e5e0ic::v0.11.0.pre
  23:     0x7fd4845f54f0 - middle::trans::controlflow::trans_if::hcea473d2050d7403Dmc::v0.11.0.pre
  24:     0x7fd4846374c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb6a52facd2ebe117umg::v0.11.0.pre
  25:     0x7fd4845f4b30 - middle::trans::expr::trans_into::hf6cfd7b67570103dpvf::v0.11.0.pre
  26:     0x7fd4845f50d0 - middle::trans::controlflow::trans_block::h591e39dcfd941e5e0ic::v0.11.0.pre
  27:     0x7fd4846b9630 - middle::trans::base::trans_closure::h02f596fb01b0b2e0Xkq::v0.11.0.pre
  28:     0x7fd4845c3db0 - middle::trans::base::trans_fn::h6bc5ecdcaec1151aYsq::v0.11.0.pre
  29:     0x7fd4845bc420 - middle::trans::base::trans_item::hfeeac4af1b332808nJq::v0.11.0.pre
  30:     0x7fd4846ca8a0 - middle::trans::base::trans_crate::h74f6a3231c20c466PCr::v0.11.0.pre
  31:     0x7fd484ef82a0 - driver::driver::phase_4_translate_to_llvm::h5468dd3223cb1730xvv::v0.11.0.pre
  32:     0x7fd484eec5f0 - driver::driver::compile_input::h956ea0cfd2bc5873Bav::v0.11.0.pre
  33:     0x7fd484fb70a0 - driver::run_compiler::hf66f8f8e8ba58aaa9Rx::v0.11.0.pre
  34:     0x7fd484fb6fb0 - driver::main_args::closure.98523
  35:     0x7fd484fd2b10 - driver::monitor::closure.99613
  36:     0x7fd484fcda50 - task::TaskBuilder::try::closure.99376
  37:     0x7fd487002cf0 - task::spawn_opts::closure.7149
  38:     0x7fd483f5b780 - task::Task::run::closure.5303
  39:     0x7fd483fc61b0 - rust_try
  40:     0x7fd483f5e1c0 - unwind::try::h1607dd06ad9105b4fGd::v0.11.0.pre
  41:     0x7fd483f5b600 - task::Task::run::hcb1447ce6c1c6534VVc::v0.11.0.pre
  42:     0x7fd487002a90 - task::spawn_opts::closure.7122
  43:     0x7fd483f5d790 - thread::thread_start::h88783297762ac3a3kdd::v0.11.0.pre
  44:       0x3109007c40 - start_thread
  45:       0x31088f2509 - clone
  46:                0x0 - &lt;unknown&gt;

make: *** [fact] Error 101"><pre class="notranslate"><code class="notranslate">$ RUST_BACKTRACE=1 make
rustc -L . -O -g fact.rs
error: internal compiler error: Type metadata for unique id '{&amp;{&amp;[]{struct c5265340fd5e95cf/2157e}}}' 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/a_m0d/workspace/rust/rust-git/src/libsyntax/diagnostic.rs:162

stack backtrace:
   1:     0x7fd483b46b10 - rt::backtrace::imp::write::hcabbaed93b4a98e5BGp::v0.11.0.pre
   2:     0x7fd483b4e240 - failure::on_fail::hbb978a5d8c60ba05O1p::v0.11.0.pre
   3:     0x7fd483f5ebd0 - unwind::begin_unwind_inner::h44989725a2971cebQRd::v0.11.0.pre
   4:     0x7fd482e3ba10 - unwind::begin_unwind::h14189599302266478606::v0.11.0.pre
   5:     0x7fd482e3c450 - diagnostic::Handler::bug::h7c581c7c950ff91bW3b::v0.11.0.pre
   6:     0x7fd4845c2a20 - driver::session::Session::bug::h0b37439c222facdbMkw::v0.11.0.pre
   7:     0x7fd48471efd0 - middle::trans::debuginfo::TypeMap::register_unique_id_with_metadata::hd285f7ffd8d40948YpB::v0.11.0.pre
   8:     0x7fd48472ad40 - middle::trans::debuginfo::type_metadata::h7e40fd5de8f2084c1ZD::v0.11.0.pre
   9:     0x7fd48472fa00 - middle::trans::debuginfo::declare_local::h2ef60ae7ae4e79152DC::v0.11.0.pre
  10:     0x7fd48472ed20 - middle::trans::debuginfo::create_local_var_metadata::closure.68299
  11:     0x7fd484b247c0 - middle::pat_util::pat_bindings::closure.80677
  12:     0x7fd482e83580 - ast_util::walk_pat::h986992b8f14168226Du::v0.11.0.pre
  13:     0x7fd4845f3420 - middle::trans::controlflow::trans_stmt::h24d6d571b97ebc4aKdc::v0.11.0.pre
  14:     0x7fd4845f50d0 - middle::trans::controlflow::trans_block::h591e39dcfd941e5e0ic::v0.11.0.pre
  15:     0x7fd4846374c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb6a52facd2ebe117umg::v0.11.0.pre
  16:     0x7fd4845f4b30 - middle::trans::expr::trans_into::hf6cfd7b67570103dpvf::v0.11.0.pre
  17:     0x7fd48464b410 - middle::trans::_match::trans_match::h32a62d3fd67945c7Kmu::v0.11.0.pre
  18:     0x7fd4846374c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb6a52facd2ebe117umg::v0.11.0.pre
  19:     0x7fd4845f4b30 - middle::trans::expr::trans_into::hf6cfd7b67570103dpvf::v0.11.0.pre
  20:     0x7fd4845f3e20 - middle::trans::controlflow::trans_stmt_semi::he15d494a96ca551a7hc::v0.11.0.pre
  21:     0x7fd4845f3420 - middle::trans::controlflow::trans_stmt::h24d6d571b97ebc4aKdc::v0.11.0.pre
  22:     0x7fd4845f50d0 - middle::trans::controlflow::trans_block::h591e39dcfd941e5e0ic::v0.11.0.pre
  23:     0x7fd4845f54f0 - middle::trans::controlflow::trans_if::hcea473d2050d7403Dmc::v0.11.0.pre
  24:     0x7fd4846374c0 - middle::trans::expr::trans_rvalue_dps_unadjusted::hb6a52facd2ebe117umg::v0.11.0.pre
  25:     0x7fd4845f4b30 - middle::trans::expr::trans_into::hf6cfd7b67570103dpvf::v0.11.0.pre
  26:     0x7fd4845f50d0 - middle::trans::controlflow::trans_block::h591e39dcfd941e5e0ic::v0.11.0.pre
  27:     0x7fd4846b9630 - middle::trans::base::trans_closure::h02f596fb01b0b2e0Xkq::v0.11.0.pre
  28:     0x7fd4845c3db0 - middle::trans::base::trans_fn::h6bc5ecdcaec1151aYsq::v0.11.0.pre
  29:     0x7fd4845bc420 - middle::trans::base::trans_item::hfeeac4af1b332808nJq::v0.11.0.pre
  30:     0x7fd4846ca8a0 - middle::trans::base::trans_crate::h74f6a3231c20c466PCr::v0.11.0.pre
  31:     0x7fd484ef82a0 - driver::driver::phase_4_translate_to_llvm::h5468dd3223cb1730xvv::v0.11.0.pre
  32:     0x7fd484eec5f0 - driver::driver::compile_input::h956ea0cfd2bc5873Bav::v0.11.0.pre
  33:     0x7fd484fb70a0 - driver::run_compiler::hf66f8f8e8ba58aaa9Rx::v0.11.0.pre
  34:     0x7fd484fb6fb0 - driver::main_args::closure.98523
  35:     0x7fd484fd2b10 - driver::monitor::closure.99613
  36:     0x7fd484fcda50 - task::TaskBuilder::try::closure.99376
  37:     0x7fd487002cf0 - task::spawn_opts::closure.7149
  38:     0x7fd483f5b780 - task::Task::run::closure.5303
  39:     0x7fd483fc61b0 - rust_try
  40:     0x7fd483f5e1c0 - unwind::try::h1607dd06ad9105b4fGd::v0.11.0.pre
  41:     0x7fd483f5b600 - task::Task::run::hcb1447ce6c1c6534VVc::v0.11.0.pre
  42:     0x7fd487002a90 - task::spawn_opts::closure.7122
  43:     0x7fd483f5d790 - thread::thread_start::h88783297762ac3a3kdd::v0.11.0.pre
  44:       0x3109007c40 - start_thread
  45:       0x31088f2509 - clone
  46:                0x0 - &lt;unknown&gt;

make: *** [fact] Error 101
</code></pre></div>
<p dir="auto">Note that this just started happening last night, and occurs for a number of small programs - see sample output <a href="https://travis-ci.org/am0d/rust-projects/builds/27565687" rel="nofollow">here</a>.</p>
<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>