Rust: Unexpected panic when building with WebAssembly

Created on 21 Jan 2018  路  2Comments  路  Source: rust-lang/rust

I'm trying to port the minifb crate to WebAssembly: repo.

The last code I added was:

extern crate lazy_static;

I tried to run the wasm.rs example with the following command:

export RUST_BACKTRACE=1 && cargo build --example wasm --target wasm32-unknown-unknown

I expected to see this happen: A reasonable error message.

Instead, this happened: I got an unexpected panic.

Meta

rustc --version --verbose:

rustc 1.25.0-nightly (15a1e2844 2018-01-20)
binary: rustc
commit-hash: 15a1e2844dfea7850be5c6c901b67ceff370b0eb
commit-date: 2018-01-20
host: x86_64-unknown-linux-gnu
release: 1.25.0-nightly
LLVM version: 4.0

Backtrace:

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `2`,
 right: `1`', librustc_trans/back/link.rs:1403:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
         at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
         at libstd/sys_common/backtrace.rs:68
         at libstd/sys_common/backtrace.rs:57
   2: std::panicking::default_hook::{{closure}}
         at libstd/panicking.rs:380
   3: std::panicking::default_hook
         at libstd/panicking.rs:390
   4: std::panicking::rust_panic_with_hook
         at libstd/panicking.rs:576
   5: std::panicking::begin_panic
         at libstd/panicking.rs:537
   6: std::panicking::begin_panic_fmt
         at libstd/panicking.rs:521
   7: rustc_trans::back::link::link_natively
   8: rustc_trans::back::link::link_binary
   9: <rustc_trans::LlvmTransCrate as rustc_trans_utils::trans_crate::TransCrate>::link_binary
  10: rustc_driver::driver::compile_input
  11: rustc_driver::run_compiler

error: Could not compile `minifb`.
A-incr-comp C-bug I-ICE O-wasm T-compiler

Most helpful comment

Thanks for the report! This is due to the fact that wasm compilation isn't currently compatible with incremental compilation, and with incremental enabled wasm's not quite working yet and can cause this ICE. For now you can temporarily disable this with:

[profile.dev]
incremental = false

All 2 comments

Thanks for the report! This is due to the fact that wasm compilation isn't currently compatible with incremental compilation, and with incremental enabled wasm's not quite working yet and can cause this ICE. For now you can temporarily disable this with:

[profile.dev]
incremental = false
Was this page helpful?
0 / 5 - 0 ratings