{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/29320","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/29320/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/29320/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/29320/events","html_url":"https://github.com/rust-lang/rust/issues/29320","id":113335709,"number":29320,"title":"ICE: thread 'rustc' panicked at 'index out of bounds: the len is 8 but the index is 10', src/libcollections/vec.rs:1261","user":{"login":"pablocouto","id":526124,"avatar_url":"https://avatars.githubusercontent.com/u/526124?v=3","gravatar_id":"","url":"https://api.github.com/users/pablocouto","html_url":"https://github.com/pablocouto","followers_url":"https://api.github.com/users/pablocouto/followers","following_url":"https://api.github.com/users/pablocouto/following{/other_user}","gists_url":"https://api.github.com/users/pablocouto/gists{/gist_id}","starred_url":"https://api.github.com/users/pablocouto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablocouto/subscriptions","organizations_url":"https://api.github.com/users/pablocouto/orgs","repos_url":"https://api.github.com/users/pablocouto/repos","events_url":"https://api.github.com/users/pablocouto/events{/privacy}","received_events_url":"https://api.github.com/users/pablocouto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-ICE","name":"I-ICE","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-26T11:27:34Z","updated_at":"2015-11-12T07:03:18Z","closed_at":null,"body":"The following code produces an ICE with rustc 1.3.0 ([playpen](http://is.gd/ijXVph)):\r\n\r\n```rust\r\nfn main() {\r\n    let mut v = vec![];\r\n    let r: &&mut Vec<i32> = &mut v;\r\n}\r\n```\r\n\r\nThis is the output of `RUST_BACKTRACE=1 rustc panics.rs`:\r\n\r\n```\r\npanics.rs:3:29: 3:35 error: mismatched types:\r\n expected `&&mut collections::vec::Vec<i32>`,\r\n    found `&mut collections::vec::Vec<_>`\r\n(expected &-ptr,\r\n    found struct `collections::vec::Vec`) [E0308]\r\npanics.rs:3     let r: &&mut Vec<i32> = &mut v;\r\n                                        ^~~~~~\r\npanics.rs:3:29: 3:35 help: run `rustc --explain E0308` to see a detailed explanation\r\nerror: internal compiler error: unexpected panic\r\nnote: the compiler unexpectedly panicked. this is a bug.\r\nnote: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports\r\nthread 'rustc' panicked at 'index out of bounds: the len is 8 but the index is 10', src/libcollections/vec.rs:1261\r\n\r\nstack backtrace:\r\n   1:     0x7f54c99bf66e - sys::backtrace::write::ha67a6a2049d22fadIvs\r\n   2:     0x7f54c99c7d55 - panicking::on_panic::hfa4bf0215983f759lzx\r\n   3:     0x7f54c998894e - rt::unwind::begin_unwind_inner::ha1b5da93bdf7e8ffC0w\r\n   4:     0x7f54c99896b6 - rt::unwind::begin_unwind_fmt::hac9e09b20e42a51cIZw\r\n   5:     0x7f54c99c78f6 - rust_begin_unwind\r\n   6:     0x7f54c9a0eb64 - panicking::panic_fmt::hd75b6cee85f3afe4SgC\r\n   7:     0x7f54c9a09b27 - panicking::panic_bounds_check::h75be7bf05a80539eYfC\r\n   8:     0x7f54c7a8d4c6 - middle::infer::freshen::TypeFreshener<'a, 'tcx>.TypeFolder<'tcx>::fold_ty::hc9c9eb98be33b949RaA\r\n   9:     0x7f54c7a8e72c - middle::ty_fold::TypeFolder::fold_substs::h2722752635261880804\r\n  10:     0x7f54c79f65be - middle::traits::select::SelectionContext<'cx, 'tcx>::select::h1f87e60efc15a3ecM9T\r\n  11:     0x7f54c7b07b32 - middle::traits::fulfill::process_predicate::hb3b7f7641fd49fc3S4R\r\n  12:     0x7f54c7b062d1 - middle::traits::fulfill::FulfillmentContext<'tcx>::select::h79dd37a3da2ede60kYR\r\n  13:     0x7f54c7b05de7 - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::h655917464134b2c15WR\r\n  14:     0x7f54c91ad9a6 - check::FnCtxt<'a, 'tcx>::select_obligations_where_possible::h95b463f889462e983Ap\r\n  15:     0x7f54c919ffb3 - check::FnCtxt<'a, 'tcx>::select_all_obligations_and_apply_defaults::h3ad48213dc81f2c2ilp\r\n  16:     0x7f54c919d563 - check::check_bare_fn::hea668edfab6ab1e7Hyn\r\n  17:     0x7f54c919b755 - check::check_item_body::h65a80a5fa29972acHYn\r\n  18:     0x7f54c919d184 - check::check_item_types::he8badf30eb589763ewn\r\n  19:     0x7f54c925cbab - check_crate::h341139d405597625laD\r\n  20:     0x7f54c9f27199 - driver::phase_3_run_analysis_passes::closure.16542\r\n  21:     0x7f54c9f25ab1 - middle::ty::ctxt<'tcx>::create_and_enter::h9578579149294230291\r\n  22:     0x7f54c9f20991 - driver::phase_3_run_analysis_passes::h8415522514568150077\r\n  23:     0x7f54c9f04a90 - driver::compile_input::h52c7dafd49963360Tba\r\n  24:     0x7f54c9feaa63 - run_compiler::h473c62e00f865fa9A7b\r\n  25:     0x7f54c9fe84de - boxed::F.FnBox<A>::call_box::h10713159552398332324\r\n  26:     0x7f54c9fe7e09 - rt::unwind::try::try_fn::h16887904248528792425\r\n  27:     0x7f54c99c784d - __rust_try\r\n  28:     0x7f54c99b28f7 - rt::unwind::try::inner_try::hafffff77ddacfa5fvWw\r\n  29:     0x7f54c9fe8028 - boxed::F.FnBox<A>::call_box::h5417278073590676257\r\n  30:     0x7f54c99c6991 - sys::thread::Thread::new::thread_start::h29dca2a2cf2294b535v\r\n  31:     0x7f54c423e4a3 - start_thread\r\n  32:     0x7f54c962013c - clone\r\n  33:                0x0 - <unknown>\r\n```\r\n\r\n## Meta\r\n\r\n```\r\nrustc 1.3.0\r\nbinary: rustc\r\ncommit-hash: unknown\r\ncommit-date: unknown\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 1.3.0\r\n```"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/156019264","html_url":"https://github.com/rust-lang/rust/issues/29320#issuecomment-156019264","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/29320","id":156019264,"user":{"login":"barosl","id":573768,"avatar_url":"https://avatars.githubusercontent.com/u/573768?v=3","gravatar_id":"","url":"https://api.github.com/users/barosl","html_url":"https://github.com/barosl","followers_url":"https://api.github.com/users/barosl/followers","following_url":"https://api.github.com/users/barosl/following{/other_user}","gists_url":"https://api.github.com/users/barosl/gists{/gist_id}","starred_url":"https://api.github.com/users/barosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barosl/subscriptions","organizations_url":"https://api.github.com/users/barosl/orgs","repos_url":"https://api.github.com/users/barosl/repos","events_url":"https://api.github.com/users/barosl/events{/privacy}","received_events_url":"https://api.github.com/users/barosl/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T07:03:18Z","updated_at":"2015-11-12T07:03:18Z","body":"It seems that `fcx.select_all_obligations_and_apply_defaults()` in `check_bare_fn` is causing the ICE. I was able to fix the issue by prepending `abort_if_errors()` before the call.\r\n\r\nBut if we do that, the maximum number of errors that can be emitted per iteration will be reduced. (If a function fails to type check, the remaining functions will not be checked at all.) Is this acceptable? Or should we find another solution?"}}