Closed
Description
The following rust code crashes rustc 1.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
.
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
pub extern fn third(a: Vec(u32)) -> u32 {
return a[3]
}
(Note, changing Vec(u32)
to Vec<u32>
fixes the crash.)
Meta
Running with RUST_BACKTRACE, I get the following error message.
Compiling wasm_sample v0.1.0 (/home/david/Documents/rust/wasm_sample_2)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:76
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:60
4: core::fmt::write
at src/libcore/fmt/mod.rs:1030
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1412
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:64
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:196
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
12: std::panicking::continue_panic_fmt
at src/libstd/panicking.rs:380
13: rust_begin_unwind
at src/libstd/panicking.rs:307
14: core::panicking::panic_fmt
at src/libcore/panicking.rs:85
15: core::panicking::panic
at src/libcore/panicking.rs:49
16: rustc::hir::lowering::LoweringContext::lower_path_segment
17: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
18: <rustc::hir::ptr::P<[T]> as core::iter::traits::collect::FromIterator<T>>::from_iter
19: rustc::hir::lowering::LoweringContext::lower_qpath
20: rustc::hir::lowering::LoweringContext::lower_path_ty
21: rustc::hir::lowering::LoweringContext::lower_ty_direct
22: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
23: <rustc::hir::ptr::P<[T]> as core::iter::traits::collect::FromIterator<T>>::from_iter
24: rustc::hir::lowering::LoweringContext::lower_fn_decl
25: rustc::hir::lowering::item::<impl rustc::hir::lowering::LoweringContext>::lower_item
26: rustc::hir::lowering::LoweringContext::with_hir_id_owner
27: <rustc::hir::lowering::item::ItemLowerer as syntax::visit::Visitor>::visit_mod
28: rustc::hir::lowering::lower_crate
29: rustc::util::common::time
30: rustc_interface::passes::BoxedResolver::access::{{closure}}
31: rustc_interface::passes::configure_and_expand::{{closure}}
32: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::access
33: rustc_interface::queries::Query<T>::compute
34: rustc_interface::queries::Query<T>::compute
35: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::prepare_outputs
36: rustc_interface::interface::run_compiler_in_existing_thread_pool
37: std::thread::local::LocalKey<T>::with
38: scoped_tls::ScopedKey<T>::set
39: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.39.0 (4560ea788 2019-11-04) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type cdylib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
error: could not compile `wasm_sample`.
To learn more, run the command again with --verbose.
rustc --version --verbose
yields
rustc 1.39.0 (4560ea788 2019-11-04)
binary: rustc
commit-hash: 4560ea788cb760f0a34127156c78e2552949f734
commit-date: 2019-11-04
host: x86_64-unknown-linux-gnu
release: 1.39.0
LLVM version: 9.0
Thank you.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Compiler frontend (errors, parsing and HIR)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Category: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️High priorityRelevant to the compiler team, which will review and decide on the PR/issue.