Skip to content

ICE with Rust 1.9.0 #34428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
evanw opened this issue Jun 23, 2016 · 2 comments
Closed

ICE with Rust 1.9.0 #34428

evanw opened this issue Jun 23, 2016 · 2 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@evanw
Copy link

evanw commented Jun 23, 2016

I just hit a crash in the compiler. I'm not sure if it works with the nightly build or not because https://play.rust-lang.org is down (it currently says "502 Bad Gateway" after loading for a while).

Anyway, the following code:

use std::mem::swap;

fn foo<T>(a: &mut Vec<T>) {
  let mut b = Vec::new();
  swap(&mut a, &mut b);
}

fn main() {
}

crashes when compiled:

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: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 9 but the index is 11', ../src/libcollections/vec.rs:1166
stack backtrace:
   1:        0x10d8a83a8 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
   2:        0x10d8b47f5 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
   3:        0x10d8b432f - std::panicking::default_hook::haac48fa641db8fa2
   4:        0x10d878f86 - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
   5:        0x10d87b08e - std::sys_common::unwind::begin_unwind_fmt::h64c0ff793199cc1b
   6:        0x10d8a5ba7 - rust_begin_unwind
   7:        0x10d8f0df0 - core::panicking::panic_fmt::h73bf9d7e8e891a73
   8:        0x10d8f1000 - core::panicking::panic_bounds_check::hc30e971884568c27
   9:        0x10c36a6b9 - _<rustc_data_structures..unify..UnificationTable<K>>::get::he21ecf90e8e4f73a
  10:        0x10c2fea74 - rustc::infer::InferCtxt::shallow_resolve::he47cdea6677f40d2
  11:        0x10c467d91 - rustc::traits::fulfill::process_predicate::h8bbef05b37cf149a
  12:        0x10c466ba3 - _<rustc_data_structures..obligation_forest..ObligationForest<O, T>>::process_obligations::h824becaa5c013776
  13:        0x10c4621fc - rustc::traits::fulfill::FulfillmentContext::select_where_possible::hf3fc6484c301b5bb
  14:        0x10969afe4 - rustc_typeck::check::FnCtxt::select_obligations_where_possible::h623b6ae6ad660b2d
  15:        0x1096ad25c - rustc_typeck::check::FnCtxt::resolve_type_vars_if_possible::ha2a2b0468a33b7be
  16:        0x1096c25fa - rustc_typeck::check::demand::coerce::hd43013069440cf8a
  17:        0x1096bff00 - rustc_typeck::check::check_argument_types::ha726e4d47c9cf6ca
  18:        0x1097491ad - rustc_typeck::check::callee::confirm_builtin_call::h5c89fdde94ec7d50
  19:        0x1096dc632 - rustc_typeck::check::callee::check_call::h9d2b45441ce6bc57
  20:        0x1096c3c9a - rustc_typeck::check::check_expr_with_expectation_and_lvalue_pref::h76666174c4b17386
  21:        0x1096faed6 - rustc_typeck::check::check_stmt::h90d31dcbe73b93a2
  22:        0x1096a0d87 - rustc_typeck::check::check_block_with_expected::h17e4ec74708f2b9a
  23:        0x1096983c8 - rustc_typeck::check::check_fn::hab7334b30b5aec4a
  24:        0x109695c67 - rustc_typeck::check::check_bare_fn::h85926feaf1e6659d
  25:        0x109690b39 - rustc_typeck::check::check_item_body::h1895344155d5b2b2
  26:        0x1096889bb - rustc_typeck::check::check_item_bodies::h525c1aa0e1abb529
  27:        0x1096801eb - rustc_typeck::check_crate::h0ef96f4043e1e69a
  28:        0x109417158 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::hc699330eb6f2bc1e
  29:        0x109415392 - rustc::ty::context::TyCtxt::create_and_enter::h656b2d3a4956519e
  30:        0x109411cdc - rustc_driver::driver::phase_3_run_analysis_passes::h83da042ec4b8ea10
  31:        0x1093e5571 - rustc_driver::driver::compile_input::h6491aaddd9e61258
  32:        0x1093cbd8f - rustc_driver::run_compiler::h80b2ba5e4d787c5f
  33:        0x1093c9122 - std::sys_common::unwind::try::try_fn::h34e27823ddd1d5e9
  34:        0x10d8a5b3b - __rust_try
  35:        0x10d8a5ac3 - std::sys_common::unwind::inner_try::h9eebd8dc83f388a6
  36:        0x1093c99b9 - _<F as std..boxed..FnBox<A>>::call_box::h3d5d78986dfac5b2
  37:        0x10d8b36c8 - std::sys::thread::Thread::new::thread_start::h471ad90789353b5b
  38:     0x7fff8c7fd059 - _pthread_body
  39:     0x7fff8c7fcfd6 - _pthread_start

Output of rustc --version --verbose:

rustc 1.9.0 (e4e8b6668 2016-05-18)
binary: rustc
commit-hash: e4e8b666850a763fdf1c3c2c142856ab51e32779
commit-date: 2016-05-18
host: x86_64-apple-darwin
release: 1.9.0
@apasel422 apasel422 added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 23, 2016
@Stebalien
Copy link
Contributor

Stebalien commented Jun 23, 2016

It works for me on nightly (rustc 1.11.0-nightly (bb4a79b08 2016-06-15)).

Edit: Well, spits out the correct error and doesn't crash:

tmp.rs:5:18: 5:24 error: mismatched types [E0308]
tmp.rs:5     swap(&mut a, &mut b);
                          ^~~~~~
tmp.rs:5:18: 5:24 help: run `rustc --explain E0308` to see a detailed explanation
tmp.rs:5:18: 5:24 note: expected type `&mut &mut std::vec::Vec<T>`
tmp.rs:5:18: 5:24 note:    found type `&mut std::vec::Vec<_>`
error: aborting due to previous error

@alexcrichton
Copy link
Member

Fixed on nightly now, so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants