Closed
Description
I get the ICE below when I compile this fragment of code:
static FUNCS: [ErlNifFunc; 1] = [
ErlNifFunc{ name: "native_add\0",
arity: 2,
function: native_add,
flags: 0,
}
];
#[no_mangle]
pub extern "C" fn nif_init() -> *const ErlNifEntry {
static ENTRY: ErlNifEntry = ErlNifEntry{
major : NIF_MAJOR_VERSION,
minor : NIF_MINOR_VERSION,
name : "rustnif\0",
num_of_funcs : 1,
funcs : &FUNCS, <-------- ICE here
load : None,
reload : None,
upgrade : None,
unload : None,
vm_variant : "beam.vanilla\0",
options: 0,
};
&ENTRY
}
The above structs are defined here: https://github.com/goertzenator/rustertest/blob/995b9f2cf484cd753e2818adb95ec8ad5370456c/src/lib.rs
The above fragment is part of https://github.com/goertzenator/rustertest/tree/995b9f2cf484cd753e2818adb95ec8ad5370456c
That crate depends on https://github.com/goertzenator/ruster/tree/e1bf38e30f1bcf2caf17080ed57b7cdc70ff182f
And that crate requires erlang-17.4 to be installed.
$ RUST_BACKTRACE=1 cargo build --verbose
Compiling ruster v0.0.1 (file:///home/goertzen/rustertest)
Running `rustc ../ruster/build.rs --crate-name build-script-build --crate-type bin -C prefer-dynamic -g --out-dir /home/goertzen/rustertest/target/build/ruster-5d949bf2a9438c3e --emit=dep-info,link -L dependency=/home/goertzen/rustertest/target/deps -L dependency=/home/goertzen/rustertest/target/deps`
../ruster/build.rs:14:22: 14:32 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/build.rs:14 let dst = Path::new(os::getenv("OUT_DIR").unwrap());
^~~~~~~~~~
../ruster/build.rs:14:12: 14:21 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/build.rs:14 let dst = Path::new(os::getenv("OUT_DIR").unwrap());
^~~~~~~~~
../ruster/build.rs:15:52: 15:60 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/build.rs:15 Command::new(escript).arg("gen_api.erl").arg(dst).status().unwrap();
^~~~~~~~
../ruster/build.rs:15:43: 15:51 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/build.rs:15 Command::new(escript).arg("gen_api.erl").arg(dst).status().unwrap();
^~~~~~~~
../ruster/build.rs:15:24: 15:42 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/build.rs:15 Command::new(escript).arg("gen_api.erl").arg(dst).status().unwrap();
^~~~~~~~~~~~~~~~~~
../ruster/build.rs:15:2: 15:14 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/build.rs:15 Command::new(escript).arg("gen_api.erl").arg(dst).status().unwrap();
^~~~~~~~~~~~
Running `/home/goertzen/rustertest/target/build/ruster-5d949bf2a9438c3e/build-script-build`
Running `rustc ../ruster/src/lib.rs --crate-name ruster --crate-type lib -g -C metadata=5d949bf2a9438c3e -C extra-filename=-5d949bf2a9438c3e --out-dir /home/goertzen/rustertest/target/deps --emit=dep-info,link -L dependency=/home/goertzen/rustertest/target/deps -L dependency=/home/goertzen/rustertest/target/deps`
../ruster/src/lib.rs:4:1: 4:19 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/src/lib.rs:4 extern crate libc;
^~~~~~~~~~~~~~~~~~
../ruster/src/lib.rs:5:1: 5:19 warning: use of unstable item, #[warn(unstable)] on by default
../ruster/src/lib.rs:5 extern crate core;
^~~~~~~~~~~~~~~~~~
../ruster/src/raw.rs:48:13: 48:17 warning: use of unstable item: will be overhauled with new lifetime rules; see RFC 458, #[warn(unstable)] on by default
../ruster/src/raw.rs:48 unsafe impl Sync for ErlNifFunc {}
^~~~
../ruster/src/raw.rs:69:13: 69:17 warning: use of unstable item: will be overhauled with new lifetime rules; see RFC 458, #[warn(unstable)] on by default
../ruster/src/raw.rs:69 unsafe impl Sync for ErlNifEntry {}
^~~~
Compiling rustertest v0.0.1 (file:///home/goertzen/rustertest)
Running `rustc src/lib.rs --crate-name rustertest --crate-type dylib -g -C metadata=4f82dbe309ba1762 -C extra-filename=-4f82dbe309ba1762 --out-dir /home/goertzen/rustertest/target --emit=dep-info,link -L dependency=/home/goertzen/rustertest/target -L dependency=/home/goertzen/rustertest/target/deps --extern ruster=/home/goertzen/rustertest/target/deps/libruster-5d949bf2a9438c3e.rlib`
src/lib.rs:2:1: 2:19 warning: use of unstable item, #[warn(unstable)] on by default
src/lib.rs:2 extern crate core;
^~~~~~~~~~~~~~~~~~
src/lib.rs:6:5: 6:23 warning: unused import, #[warn(unused_imports)] on by default
src/lib.rs:6 use core::marker::Sync;
^~~~~~~~~~~~~~~~~~
src/lib.rs:95:11: 95:17 error: internal compiler error: unimplemented const autoref AutoUnsafe(MutImmutable, Some(Box(AutoUnsize(UnsizeLength(1u)))))
src/lib.rs:95 funcs : &FUNCS,
^~~~~~
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:123
stack backtrace:
1: 0x7fe039c2b000 - sys::backtrace::write::h7e8ba1fc274cc36epRt
2: 0x7fe039c4c9e0 - failure::on_fail::h823798930ebe140a64z
3: 0x7fe039bbb7b0 - rt::unwind::begin_unwind_inner::ha4a8df6010104da6ZJz
4: 0x7fe034825330 - rt::unwind::begin_unwind::h2017061421562134061
5: 0x7fe0348252c0 - diagnostic::SpanHandler::span_bug::h26a451e055cae458CYF
6: 0x7fe037d10810 - session::Session::span_bug::h64d8052083ced862Ebr
7: 0x7fe038c787e0 - trans::consts::const_expr::h94628210c8390bc6T3n
8: 0x7fe038c7fd80 - trans::consts::const_expr_unadjusted::unboxed_closure.43028
9: 0x7fe038c7fb90 - vec::Vec<T>.FromIterator<T>::from_iter::h7269795553161279336
10: 0x7fe038c7fa80 - trans::consts::const_expr_unadjusted::unboxed_closure.43026
11: 0x7fe038c7a580 - trans::consts::const_expr_unadjusted::h129554d528e2e7e9Meo
12: 0x7fe038c787e0 - trans::consts::const_expr::h94628210c8390bc6T3n
13: 0x7fe038bb3480 - trans::base::get_item_val::hd9784892acf07040s3u
14: 0x7fe038c2a480 - trans::expr::trans_def::h982a9743604bd027RIi
15: 0x7fe038c11910 - trans::expr::trans_unadjusted::hb6ffa8ee55ffe7847ji
16: 0x7fe038bcb3d0 - trans::expr::trans::hde666e6a090eadc0xCh
17: 0x7fe038c2d770 - trans::expr::trans_addr_of::h957baa9beeb8dce62Kj
18: 0x7fe038c11910 - trans::expr::trans_unadjusted::hb6ffa8ee55ffe7847ji
19: 0x7fe038bcb3d0 - trans::expr::trans::hde666e6a090eadc0xCh
20: 0x7fe038bca1e0 - trans::expr::trans_into::h1a40b70708c7d89d3yh
21: 0x7fe038bca7e0 - trans::controlflow::trans_block::h28afa8af906ef58bQ3d
22: 0x7fe038c94c80 - trans::base::trans_closure::h9a0d2c21a0e18266U0t
23: 0x7fe038bb5dd0 - trans::base::trans_fn::hc26bd010ed3bb393zbu
24: 0x7fe038bc68e0 - trans::foreign::trans_rust_fn_with_foreign_abi::h3754480a372f8380UlC
25: 0x7fe038bb11f0 - trans::base::trans_item::h1e3916042030bab0Uyu
26: 0x7fe038c9bf20 - trans::base::trans_crate::h035c45eac4628807Buv
27: 0x7fe03a18ab60 - driver::phase_4_translate_to_llvm::h1b361a483c335af2YMa
28: 0x7fe03a16ad70 - driver::compile_input::h8ec974b2bd4afe59Aba
29: 0x7fe03a22c4d0 - run_compiler::h0e495a7c10e57aaae5b
30: 0x7fe03a22ac40 - thunk::F.Invoke<A, R>::invoke::h12226774702741163622
31: 0x7fe03a229ba0 - rt::unwind::try::try_fn::h67848939709837360
32: 0x7fe039cb3b90 - rust_try_inner
33: 0x7fe039cb3b80 - rust_try
34: 0x7fe03a229e50 - thunk::F.Invoke<A, R>::invoke::h15720675569063176780
35: 0x7fe039c3a680 - sys::thread::thread_start::h2ac456e96ea03cedcJw
36: 0x7fe03403f0c0 - start_thread
37: 0x7fe03985bf89 - __clone
38: 0x0 - <unknown>
Could not compile `rustertest`.
Caused by:
Process didn't exit successfully: `rustc src/lib.rs --crate-name rustertest --crate-type dylib -g -C metadata=4f82dbe309ba1762 -C extra-filename=-4f82dbe309ba1762 --out-dir /home/goertzen/rustertest/target --emit=dep-info,link -L dependency=/home/goertzen/rustertest/target -L dependency=/home/goertzen/rustertest/target/deps --extern ruster=/home/goertzen/rustertest/target/deps/libruster-5d949bf2a9438c3e.rlib` (status=101)
$ uname -a
Linux ubuntu64 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
$ rustc --version
rustc 1.0.0-nightly (8903c21d6 2015-01-15 22:42:58 +0000)