Skip to content

ICE when taking reference of an array element across crate border #13077

Closed
@rsaarelm

Description

@rsaarelm

Script to reproduce:

#!/bin/sh

cat > array.rs <<EOF
pub static ARRAY: &'static [int] = &[1];
EOF

cat > main.rs <<EOF
extern crate array;
use array::ARRAY;
static X: &'static int = &ARRAY[0];
pub fn main() {}
EOF

rustc --version
rustc array.rs --crate-type rlib
RUST_BACKTRACE=1 rustc main.rs -L .

Version:

rustc 0.10-pre (092afdb 2014-03-22 00:56:47 -0700)
host: x86_64-unknown-linux-gnu

Output:

task 'rustc' failed at 'expected item, found unknown node (id=3)', /home/rsaarelm/local/rust/src/libsyntax/ast_map.rs:256
stack backtrace:
   1:     0x7fa9ece4c150 - rt::backtrace::imp::write::h65d4519594096df0zFb::v0.10.pre
   2:     0x7fa9ecdb1b20 - rt::unwind::begin_unwind_inner::h76e51d0b3f21ae573fb::v0.10.pre
   3:     0x7fa9ecdb17a0 - rt::unwind::begin_unwind_fmt::hcb4030a35e75e94bdfb::v0.10.pre
   4:     0x7fa9ebeecab0 - ast_map::Map::expect_item::h926341365065e5c2yWs::v0.10.pre
   5:     0x7fa9ed897ff0 - middle::trans::consts::get_const_val::hf35e5dbbcbb0c325gTi::v0.10.pre
   6:     0x7fa9ed898c80 - middle::trans::consts::const_expr_unadjusted::h8aa95ecf95053fc9wbj::v0.10.pre
   7:     0x7fa9ed8967f0 - middle::trans::consts::const_expr::h30ccf7f1ea2db6bb3Ui::v0.10.pre
   8:     0x7fa9ed898c80 - middle::trans::consts::const_expr_unadjusted::h8aa95ecf95053fc9wbj::v0.10.pre
   9:     0x7fa9ed8967f0 - middle::trans::consts::const_expr::h30ccf7f1ea2db6bb3Ui::v0.10.pre
  10:     0x7fa9ed898c80 - middle::trans::consts::const_expr_unadjusted::h8aa95ecf95053fc9wbj::v0.10.pre
  11:     0x7fa9ed8967f0 - middle::trans::consts::const_expr::h30ccf7f1ea2db6bb3Ui::v0.10.pre
  12:     0x7fa9ed7f2730 - middle::trans::base::get_item_val::h6d0d4cb5e1eec3caH9o::v0.10.pre
  13:     0x7fa9ed898660 - middle::trans::consts::trans_const::ha5c66b533e4b5e01rJj::v0.10.pre
  14:     0x7fa9ed7f1510 - middle::trans::base::trans_item::haefb1368e3f72c06EPo::v0.10.pre
  15:     0x7fa9ed8cb160 - middle::trans::base::trans_mod::h443add462d5f45c2PUo::v0.10.pre
  16:     0x7fa9ed8d4dd0 - middle::trans::base::trans_crate::hb821fec7a7227b18Jvq::v0.10.pre
  17:     0x7fa9edf0fcf0 - driver::driver::phase_4_translate_to_llvm::hd60d08bb19ab14c3ncf::v0.10.pre
  18:     0x7fa9edf11ec0 - driver::driver::compile_input::hea07fdb06f747ebclsf::v0.10.pre
  19:     0x7fa9edf359a0 - run_compiler::hb633d4f48873b5b685m::v0.10.pre
  20:     0x7fa9edf48c40 - main_args::closure.90956
  21:     0x7fa9edf47570 - monitor::closure.90841
  22:     0x7fa9edf42f40 - task::TaskBuilder::try::closure.90652
  23:     0x7fa9efc982c0 - task::spawn_opts::closure.7490
  24:     0x7fa9ece47870 - rt::task::Task::run::closure.40702
  25:     0x7fa9ece52c30 - rust_try
  26:     0x7fa9ece476b0 - rt::task::Task::run::hbf611f12dab23ee8848::v0.10.pre
  27:     0x7fa9efc98060 - task::spawn_opts::closure.7463
  28:     0x7fa9ece4ac10 - rt::thread::thread_start::h1eaa8730822d5e53AL9::v0.10.pre
  29:     0x7fa9ea1f8fe0 - start_thread
  30:     0x7fa9eca7cce9 - clone
  31:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions