-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Description
Code Example
this was taken from the intro doc, a few days ago. Notice that in the latest nightly you need to add a call to unwrap() after lock().
use std::thread::Thread;
use std::sync::{Arc,Mutex};
fn main() {
let numbers = Arc::new(Mutex::new(vec![1i, 2i, 3i]));
for i in range(0u, 3u) {
let number = numbers.clone();
Thread::spawn(move || {
let mut array = number.lock();
(*array)[i] += 1;
println!("numbers[{}] is {}", i, (*array)[i]);
}).detach();
}
}Output
fff.rs:12:14: 12:20 error: type `core::result::Result<std::sync::mutex::MutexGuard<'_, collections::vec::Vec<int>>, std::sync::poison::PoisonError<std::sync::mutex::MutexGuard<'_, collections::vec::Vec<int>>>>` cannot be dereferenced
fff.rs:12 (*array)[i] += 1;
^~~~~~
fff.rs:14:47: 14:53 error: type `core::result::Result<std::sync::mutex::MutexGuard<'_, collections::vec::Vec<int>>, std::sync::poison::PoisonError<std::sync::mutex::MutexGuard<'_, collections::vec::Vec<int>>>>` cannot be dereferenced
fff.rs:14 println!("numbers[{}] is {}", i, (*array)[i]);
^~~~~~
note: in expansion of format_args!
<std macros>:2:54: 2:77 note: expansion site
<std macros>:1:1: 3:2 note: in expansion of println!
fff.rs:14:13: 14:59 note: expansion site
error: internal compiler error: no type for node 71: expr i (id=71) in fcx 0x7fb3b9feca18
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-linux/build/src/libsyntax/diagnostic.rs:182
stack backtrace:
1: 0x7fb3c194f950 - sys::backtrace::write::h895a7595e35ffe42gnt
2: 0x7fb3c1974660 - failure::on_fail::hb3298435971cff34kEz
3: 0x7fb3c18db940 - rt::unwind::begin_unwind_inner::h6dee24d5dc335a63oiz
4: 0x7fb3bcaadcc0 - rt::unwind::begin_unwind::h12623432956124006653
5: 0x7fb3bcaae570 - diagnostic::Handler::bug::ha9b616024b46f3aebVF
6: 0x7fb3bfb4b770 - session::Session::bug::h12be686e19b5b0bazyp
7: 0x7fb3c0f11390 - check::FnCtxt<'a, 'tcx>::node_ty::h9b8a67e28e41ba8bSGl
8: 0x7fb3c0f24e50 - check::writeback::WritebackCx<'cx, 'tcx>::visit_node_id::h2c4dc3387755279ctHb
9: 0x7fb3c0f210e0 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h2f0f77b56a4c1394exb
10: 0x7fb3c0f24d50 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h91bc12c657353988uyb
11: 0x7fb3c0f2c970 - visit::walk_fn::h10733558075477871190
12: 0x7fb3c0f210e0 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h2f0f77b56a4c1394exb
13: 0x7fb3c0f210e0 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h2f0f77b56a4c1394exb
14: 0x7fb3c0f210e0 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h2f0f77b56a4c1394exb
15: 0x7fb3c0f24d50 - check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_block::h91bc12c657353988uyb
16: 0x7fb3c0fe32c0 - check::check_bare_fn::h24d3cb693ab9ca75Qzj
17: 0x7fb3c0fda950 - check::check_item::hb991f99d47aa82ceSSj
18: 0x7fb3c117b030 - check_crate::unboxed_closure.39833
19: 0x7fb3c1175dd0 - check_crate::hb802e7bb2dee1cd6NLx
20: 0x7fb3c1e98860 - driver::phase_3_run_analysis_passes::h83e2236a47a83223qva
21: 0x7fb3c1e870a0 - driver::compile_input::h2bdea93b5d9f3dbfwba
22: 0x7fb3c1fd2970 - thunk::F.Invoke<A, R>::invoke::h11261394929911795771
23: 0x7fb3c1fd1720 - rt::unwind::try::try_fn::h18390836921836612068
24: 0x7fb3c19da2d0 - rust_try_inner
25: 0x7fb3c19da2c0 - rust_try
26: 0x7fb3c1fd1a70 - thunk::F.Invoke<A, R>::invoke::h16439250889300796363
27: 0x7fb3c1961300 - sys::thread::thread_start::haeaaf0233fbdd5c3bgw
28: 0x7fb3bc2cf460 - start_thread
29: 0x7fb3c1590749 - clone
30: 0x0 - <unknown>Version
rustc 0.13.0-nightly (7608dba 2014-12-31 10:06:21 -0800)
binary: rustc
commit-hash: 7608dba
commit-date: 2014-12-31 10:06:21 -0800
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly
Metadata
Metadata
Assignees
Labels
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️