Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: Type metadata for unique id '{&{&[]{struct c5265340fd5e95cf/2157e}}}' is already in the TypeMap! #14895

Closed
am0d opened this issue Jun 14, 2014 · 4 comments

Comments

@am0d
Copy link
Contributor

am0d commented Jun 14, 2014

My Travis CI builds started failing yesterday for a few very simple programs. Here's a sample:

use std::os;

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

    result
}

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

        let val= fact(val);
        println!("{}", val);
    }
    else {
        println!("Usage: {} n", args.get(0));
    }
}

Here's the compiler version I'm using:

$ rustc --version
rustc 0.11.0-pre (d64f18c 2014-06-14 10:36:46 +0000)
host: x86_64-unknown-linux-gnu

Here's the output:

$ RUST_BACKTRACE=1 make
rustc -L . -O -g fact.rs
error: internal compiler error: Type metadata for unique id '{&{&[]{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<Any>', /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 - <unknown>

make: *** [fact] Error 101

Note that this just started happening last night, and occurs for a number of small programs - see sample output here.

@pnkfelix
Copy link
Member

closing as duplicate of #14871.

Note that there is a workaround described by @michaelwoerister in his discussion with nick: #14819 (comment)

(I have been considering landing this workaround since I imagine this is going to bite a lot of people, at least those who like using -g ...)

@michaelwoerister
Copy link
Member

Felix, if you'd like to commit the workaround to master, please just go ahead. In the future, I'll make things like this a warning. Not all bugs warrant aborting the program...

On June 14, 2014 5:03:33 PM CEST, Felix S Klock II [email protected] wrote:

closing as duplicate of #14871.

Note that there is a workaround described by @michaelwoerister in his
discussion with nick:
#14819 (comment)

(I have been considering landing this workaround since I imagine this
is going to bite a lot of people, at least those who like using -g
...)


Reply to this email directly or view it on GitHub:
#14895 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@pnkfelix
Copy link
Member

(just for those following along the conversation: michael ended up posted that workaround as PR #14909 .)

@SiegeLord
Copy link
Contributor

Since that PR got closed, should this be reopened? I can still reproduce it.

EDIT:

Nevermind, I got confused by the continued conversation here.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
…r=Veykril

fix: don't try determining type of token inside macro calls

When we're requested `Go to Type Definition`, we first downmap the token in question to tokens in every macro call expansion involved, and then determine the type of those mapped tokens by looking for the nearest ancestor node that is either expression or pattern (or a few others). This procedure has one flaw: When the downmapped token is inside another macro call, the nearest ancestor node to retrieve the type of is *that* macro call. That's not what we should return in general and therefore we should disregard it.

Notably, now that we expand built-in `format_arg!` and its family macros, we're always returning [`Arguments`] when one `Go to Type Definition` at `dbg!(variable$0)` along with the actual type of `variable` without this patch.

[`Arguments`]: https://doc.rust-lang.org/nightly/core/fmt/struct.Arguments.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants