Navigation Menu

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

Internal compiler error in metadata::tydecode::parse_def_id related to unboxes closures #16790

Closed
TethysSvensson opened this issue Aug 27, 2014 · 1 comment · Fixed by #18546
Labels
A-closures Area: closures (`|args| { .. }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@TethysSvensson
Copy link
Contributor

$ apt-cache policy rust-nightly && rustc -v verbose
rust-nightly:
  Installed: 201408270406~e61ec99~utopic
  Candidate: 201408270406~e61ec99~utopic
  Version table:
 *** 201408270406~e61ec99~utopic 0
        500 http://ppa.launchpad.net/hansjorg/rust/ubuntu/ utopic/main amd64 Packages
        100 /var/lib/dpkg/status
rustc 0.12.0-pre
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 0.12.0-pre
$ cat foo.rs
#![crate_name = "foo"]
#![crate_type = "rlib"]

#![feature(unboxed_closures)]

pub fn bar<T>(val: &mut Box<FnOnce<(), T>>) {
  *val = (box |:| fail!()) as Box<FnOnce<(), T>>;
}

$ cat main.rs 
extern crate foo;

fn main() {
  foo::bar::<uint>(fail!());
}
$ rustc foo.rs && echo done && RUST_BACKTRACE=1 rustc -L . main.rs
done
error: internal compiler error: unexpected failure
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 'internal error: parse_def_id: id expected, found
&[50u8, 53u8, 101u8, 199u8, 16u8, 0u8, 0u8, 27u8, 196u8, 136u8, 0u8, 0u8, 0u8,
0u8, 0u8, 0u8, 0u8, 24u8, 197u8, 16u8, 0u8, 0u8, 12u8, 154u8, 16u8, 0u8, 0u8,
7u8, 126u8, 107u8, 48u8, 58u8, 50u8, 53u8, 101u8, 199u8, 16u8, 0u8, 0u8, 26u8,
196u8, 136u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 25u8, 197u8, 16u8, 0u8, 0u8,
11u8, 154u8, 16u8, 0u8, 0u8, 6u8, 107u8, 48u8, 58u8, 50u8, 53u8, 101u8, 201u8,
16u8, 0u8, 0u8, 26u8, 196u8, 136u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 25u8,
197u8, 16u8, 0u8, 0u8, 11u8, 147u8, 16u8, 0u8, 0u8, 6u8, 148u8, 132u8, 0u8,
0u8, 0u8, 0u8, 214u8, 16u8, 0u8, 0u8, 44u8, 196u8, 136u8, 0u8, 0u8, 0u8, 0u8,
0u8, 0u8, 0u8, 25u8, 197u8, 16u8, 0u8, 0u8, 29u8, 155u8, 139u8, 67u8, 97u8,
112u8, 116u8, 117u8, 114u8, 101u8, 77u8, 111u8, 100u8, 101u8, 144u8, 16u8, 0u8,
0u8, 11u8, 145u8, 132u8, 0u8, 0u8, 0u8, 0u8, 146u8, 16u8, 0u8, 0u8, 0u8, 212u8,
16u8, 0u8, 0u8, 86u8, 196u8, 136u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 0u8, 25u8,
197u8, 16u8, 0u8, 0u8, 71u8, 154u8, 16u8, 0u8, 0u8, 30u8, 110u8, 109u8, 38u8,
116u8, 46u8, 91u8, 50u8, 53u8]',
/build/buildd/rust-nightly-201408270406~e61ec99~utopic/src/librustc/metadata/tydecode.rs:583

stack backtrace:
   1:     0x7f03c197e570 - rt::backtrace::imp::write::h7ecc632a9b3f8170c0q
   2:     0x7f03c1981760 - <unknown>
   3:     0x7f03c2168950 - unwind::begin_unwind_inner::he71f311595519d03Zie
   4:     0x7f03c21685f0 - unwind::begin_unwind_fmt::h08ab7f9fdf4ed6ecpge
   5:     0x7f03c2d39f40 - metadata::tydecode::parse_def_id::h58b712d2d6177e083xp
   6:     0x7f03c2d38c30 - <unknown>
   7:     0x7f03c2d341f0 - <unknown>
   8:     0x7f03c2d341f0 - <unknown>
   9:     0x7f03c26bc820 - metadata::tydecode::parse_ty_data::hdf484fc7b2992be41wn
  10:     0x7f03c26bda80 - <unknown>
  11:     0x7f03c26bc5e0 - <unknown>
  12:     0x7f03c2699450 - middle::astencode::reader..Decoder<'a>.rbml_decoder_decoder_helpers::read_ty::hed6189176e179eaarHe
  13:     0x7f03c26d7200 - <unknown>
  14:     0x7f03c0b7b2e0 - reader::docs::h1ca92fae2366102b2Ua
  15:     0x7f03c25772e0 - middle::astencode::decode_inlined_item::h6909096d11b0b7dan3c
  16:     0x7f03c27addb0 - <unknown>
  17:     0x7f03c2ea8360 - <unknown>
  18:     0x7f03c2d623d0 - metadata::decoder::maybe_get_item_ast::hdd02c275a9b40253hut
  19:     0x7f03c28f22a0 - middle::trans::inline::maybe_instantiate_inline::hf570f206c42708ffTyX
  20:     0x7f03c29410a0 - <unknown>
  21:     0x7f03c29135c0 - middle::trans::callee::trans_call_inner::h10aebb5fe7685fdaLD1
  22:     0x7f03c2940e30 - middle::trans::callee::trans_call::hc4f2c9ea0dad7130Qx1
  23:     0x7f03c294fc60 - <unknown>
  24:     0x7f03c2909dd0 - middle::trans::expr::trans_into::h63efa240a252a4b9js2
  25:     0x7f03c2909280 - middle::trans::controlflow::trans_stmt_semi::hab7df555c62b5a36dlY
  26:     0x7f03c2908950 - middle::trans::controlflow::trans_stmt::h2e9e6b84acdd95beWgY
  27:     0x7f03c290a370 - middle::trans::controlflow::trans_block::hef69e6e8a650479d7lY
  28:     0x7f03c29bfd00 - middle::trans::base::trans_closure::h7b69e84eff2769876xe
  29:     0x7f03c28fada0 - middle::trans::base::trans_fn::h19628e9480b57bbaTJe
  30:     0x7f03c28f60e0 - middle::trans::base::trans_item::h699a0ee17313c445T1e
  31:     0x7f03c29ca9c0 - middle::trans::base::trans_crate::hab4da120219fc0d5kWf
  32:     0x7f03c2d9c480 - driver::driver::phase_4_translate_to_llvm::h070ebeccefe401090yy
  33:     0x7f03c2d93e30 - driver::driver::compile_input::hbae99ff27dbd49ferby
  34:     0x7f03c2e25c50 - <unknown>
  35:     0x7f03c2e25b60 - <unknown>
  36:     0x7f03c2e37de0 - <unknown>
  37:     0x7f03c2e37be0 - <unknown>
  38:     0x7f03c38745f0 - <unknown>
  39:     0x7f03c21c11d0 - <unknown>
  40:     0x7f03c21c11c0 - rust_try
  41:     0x7f03c2165f80 - unwind::try::hcf3a6c26a049b912f7d
  42:     0x7f03c2165d40 - task::Task::run::hb31a60d7e6df8450zdd
  43:     0x7f03c3874350 - <unknown>
  44:     0x7f03c2167b40 - <unknown>
  45:     0x7f03c14150c0 - start_thread
  46:     0x7f03c1e2f359 - __clone
  47:                0x0 - <unknown>
@huonw huonw added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-closures Area: closures (`|args| { .. }`) labels Sep 10, 2014
@aturon aturon mentioned this issue Oct 16, 2014
47 tasks
@bkoropoff
Copy link
Contributor

This example now gives me the panic from #18378, which occurs slightly later during decoding.

This bug may have been accidentally fixed at some point, which exposed #18378. I think this just needs a test once the other crate metadata bugs have been fixed.

bors added a commit that referenced this issue Nov 5, 2014
…=nick29581

This fixes some metadata/AST encoding problems that lead to ICEs.  The way this is currently handled will need revisiting if abstract return types are added, as unboxed closure types from extern crates could show up without being inlined into the local crate.

Closes #16790 (I think this was fixed earlier by accident and just needed a test case)
Closes #18378
Closes #18543

r? @pcwalton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: closures (`|args| { .. }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants