Closed
Description
To replicate:
#![feature(closure_to_fn_coercion)]
fn main() {
let bar: fn(&mut u32) = |_| {};
}
ICE details:
rustc 1.17.0-nightly (be760566c 2017-02-28)
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 0 but the index is 0', /checkout/src/libcollections/vec.rs:1401
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: rustc::infer::region_inference::RegionVarBindings::var_origin
1: rustc::infer::error_reporting::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::note_issue_32330
2: rustc::infer::error_reporting::<impl rustc::infer::InferCtxt<'a, 'gcx, 'tcx>>::report_and_explain_type_error
3: rustc::infer::InferCtxt::report_mismatched_types
4: rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::demand_coerce
5: rustc_typeck::check::FnCtxt::check_decl_initializer
6: rustc_typeck::check::FnCtxt::check_decl_local
7: rustc_typeck::check::FnCtxt::check_stmt
8: rustc_typeck::check::FnCtxt::check_block_with_expected
9: rustc_typeck::check::FnCtxt::check_expr_kind
10: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_lvalue_pref
11: rustc_typeck::check::check_fn
12: rustc_typeck::check::typeck_tables
13: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables<'tcx>>::try_get
14: rustc::ty::maps::<impl rustc::ty::maps::queries::typeck_tables<'tcx>>::get
15: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::item_tables
16: rustc_typeck::check::check_item_bodies
17: rustc_typeck::check_crate
18: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
19: rustc_driver::driver::phase_3_run_analysis_passes
20: rustc_driver::driver::compile_input
21: rustc_driver::run_compiler
22: std::panicking::try::do_call
23: __rust_maybe_catch_panic
at /checkout/src/libpanic_unwind/lib.rs:98
24: <F as alloc::boxed::FnBox<A>>::call_box
25: std::sys::imp::thread::Thread::new::thread_start
at /checkout/src/liballoc/boxed.rs:648
at /checkout/src/libstd/sys_common/thread.rs:21
at /checkout/src/libstd/sys/unix/thread.rs:84
26: start_thread
27: clone
ref #40025