Closed
Description
I'm getting the following error compiling a simple FFI test (backtrace included below). I am creating a reference to a static pointer symbol in a C library. Then, I have a Rust object wrapper and want to create a static instance of that object that points to the pointer defined in the C library. Here is the gist of the library:
pub type MPI_Comm = *c_void;
extern {
pub static MPI_COMM_WORLD: MPI_Comm;
}
pub struct Comm {
ptr: ffi::MPI_Comm,
}
pub static COMM_WORLD: Comm = Comm { ptr: ffi::MPI_COMM_WORLD };
Backtrace
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://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'expected item, found foreign item ffi::MPI_COMM_WORLD::MPI_COMM_WORLD (id=47)', /home/nwatkins/rust/rust/src/libsyntax/ast_map.rs:264
stack backtrace:
1: 0x7f389bbf6320 - rt::backtrace::imp::write::he4a96dd9becae7baQZF::v0.11.pre
2: 0x7f389bb5e7f0 - rt::unwind::begin_unwind_inner::h429f42930e247ed3TzF::v0.11.pre
3: 0x7f389bb5da40 - rt::unwind::begin_unwind_fmt::h2658199b4e21bf1d3yF::v0.11.pre
4: 0x7f389a7d9f70 - ast_map::Map::expect_item::hfd129ba246eef9e7fmw::v0.11.pre
5: 0x7f389cb333e0 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_expr::h5cd0b6fa8c9a4f2bGTx::v0.11.pre
6: 0x7f389cb333e0 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_expr::h5cd0b6fa8c9a4f2bGTx::v0.11.pre
7: 0x7f389cb321e0 - middle::check_const::CheckItemRecursionVisitor<'a>.Visitor<(*>::visit_item::hd092905fe77dd21cLSx::v0.11.pre
8: 0x7f389cb2d7d0 - middle::check_const::check_item::h95a2cf717ce35925AHx::v0.11.pre
9: 0x7f389cb306a0 - middle::check_const::check_crate::hb33f792abf387b41bHx::v0.11.pre
10: 0x7f389cb13c40 - util::common::time::h2370236349741964365::v0.11.pre
11: 0x7f389cef3780 - driver::driver::phase_3_run_analysis_passes::h6fe36fe1431dcb23Wci::v0.11.pre
12: 0x7f389ceed280 - driver::driver::compile_input::h002d716c1383702at2h::v0.11.pre
13: 0x7f389cf90af0 - driver::main_args::closure.92546
14: 0x7f389cfa7310 - driver::monitor::closure.93721
15: 0x7f389cfa1750 - task::TaskBuilder::try::closure.93488
16: 0x7f389c15f1c0 - task::spawn_opts::closure.7382
17: 0x7f389bbeccd0 - rt::task::Task::run::closure.28450
18: 0x7f389bc0eaf0 - rust_try
19: 0x7f389bbecb10 - rt::task::Task::run::h8aff154bc145518aBoD::v0.11.pre
20: 0x7f389c15ef70 - task::spawn_opts::closure.7355
21: 0x7f389bbf4d20 - rt::thread::thread_start::ha112b5063324e752M6D::v0.11.pre
22: 0x7f38998ab0c0 - start_thread
23: 0x7f389b8292d9 - __clone
24: 0x0 - <unknown>