Closed
Description
After some discussing about static closures on IRC, I was messing around and found an ICE:
static plus_one: &'static Fn(i32) -> i32 = (&|x: i32| { x + 1 }) as &'static Fn(i32) -> i32;
error: internal compiler error: coherence failed to report ambiguity: cannot locate the impl of the trait `core::ops::Fn<(i32,)>` for the type `[[email protected]:1:46: 1:64]`
hello.rs:1 static plus_one: &'static Fn(i32) -> i32 = (&|x: i32| { x + 1 }) as &'static Fn(i32) -> i32;
^~~~~~~~~~~~~~~~~~~~~
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/diagnostic.rs:176
stack backtrace:
1: 0x7fb188388719 - sys::backtrace::write::h0942de78b6c02817K8r
2: 0x7fb1883905a6 - panicking::on_panic::h3f23f9d0b5f4c91bu9w
3: 0x7fb18835668e - rt::unwind::begin_unwind_inner::h2844b8c5e81e79558Bw
4: 0x7fb185364717 - rt::unwind::begin_unwind::h18145712027808195836
5: 0x7fb1853646d6 - diagnostic::SpanHandler::span_bug::h8e44e4841a51abaeu0A
6: 0x7fb18634d25a - middle::traits::error_reporting::report_fulfillment_errors::h333f72cab9295933RyR
7: 0x7fb1873e70c5 - check::FnCtxt<'a, 'tcx>::select_all_obligations_or_error::hcab104bc898397548ur
8: 0x7fb1873e4b83 - check::regionck::Rcx<'a, 'tcx>::visit_region_obligations::hfa6295200248132aJBc
9: 0x7fb1873e65f0 - check::regionck::Rcx<'a, 'tcx>::visit_fn_body::hef046c27196f1a04oyc
10: 0x7fb1873ec73e - visit::walk_expr::h8219604655069971555
11: 0x7fb1873e9ca6 - check::regionck::visit_expr::h7ba995ff7bd03dafSXc
12: 0x7fb1873e9ee5 - check::regionck::visit_expr::h7ba995ff7bd03dafSXc
13: 0x7fb1873ea018 - check::regionck::visit_expr::h7ba995ff7bd03dafSXc
14: 0x7fb1873ec31c - visit::walk_expr::h8219604655069971555
15: 0x7fb1873e9a8d - check::regionck::visit_expr::h7ba995ff7bd03dafSXc
16: 0x7fb1873e4778 - check::regionck::regionck_expr::h31bdba3ccd579413Aoc
17: 0x7fb18748b19b - check::check_const::hea0d071c5597530dvcu
18: 0x7fb18747941e - check::check_item_type::haa6e26c4456d14ddoKp
19: 0x7fb18753a1e2 - check_crate::hc9d8771979c9f6f1ZzE
20: 0x7fb1888d2ffe - driver::phase_3_run_analysis_passes::closure.20596
21: 0x7fb1888b1e05 - middle::ty::ctxt<'tcx>::create_and_enter::h9049188843559879450
22: 0x7fb1888acf5d - driver::phase_3_run_analysis_passes::h10313786347949334605
23: 0x7fb188890676 - driver::compile_input::h68da15dd21986404Tba
24: 0x7fb1889fb7eb - run_compiler::h707077bbe9100331Obc
25: 0x7fb1889f90b7 - boxed::F.FnBox<A>::call_box::h6790869519760498004
26: 0x7fb1889f8b24 - rt::unwind::try::try_fn::h1844525071116418565
27: 0x7fb188390148 - __rust_try
28: 0x7fb18837ca62 - rt::unwind::try::inner_try::h45702ba1ad1620941xw
29: 0x7fb1889f8cb8 - boxed::F.FnBox<A>::call_box::h11351074772415591031
30: 0x7fb18838f593 - sys::thread::Thread::new::thread_start::h66ead7b2912d4f30OHv
31: 0x7fb181fa30a3 - start_thread
32: 0x7fb18801204c - clone
33: 0x0 - <unknown>