Closed
Description
I've found compiler problem with this code:
(test1.rs)
type FuncType<'f> = |&int|: 'f -> int;
fn ho_func(f: &mut Option<FuncType>) {
match f {
&Some(ref mut f) => {(*f)(&1);},
&None => {}
}
}
fn caller() {
ho_func(&Some(|x| { 1 }));
}
Here is error:
env RUST_BACKTRACE=1 rustc --crate-type=lib test1.rs
error: internal compiler error: unexpected panic
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
task 'rustc' panicked at 'assertion failed: !ty::type_needs_infer(ty)', /build/buildd/rust-nightly-201411130408~5745e41~trusty/src/librustc/middle/typeck/mod.rs:287
stack backtrace:
1: 0x7f577775f180 - rt::backtrace::imp::write::h81d5702c49ce4aebmft
2: 0x7f5777762200 - <unknown>
3: 0x7f5777f1cb20 - unwind::begin_unwind_inner::hb1c8c16ad8e7226bE9c
4: 0x7f57782e93c0 - <unknown>
5: 0x7f57787bd2f0 - middle::typeck::write_ty_to_tcx::hefe138265214f77327o
6: 0x7f57787b9920 - <unknown>
7: 0x7f57787b7e50 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h87248c770d7445b37zO
8: 0x7f57787b7e50 - middle::typeck::check::writeback::WritebackCx<'cx, 'tcx>.Visitor<'v>::visit_expr::h87248c770d7445b37zO
9: 0x7f57787bc880 - <unknown>
10: 0x7f57787b9690 - middle::typeck::check::writeback::resolve_type_vars_in_fn::h4486f5367281e52cdvO
11: 0x7f577880f7c0 - <unknown>
12: 0x7f577880b8d0 - middle::typeck::check::check_item::hf54795e833d56931FoW
13: 0x7f577880f580 - middle::typeck::check::check_item_types::h8d2de38462aae35fG3V
14: 0x7f5778305570 - <unknown>
15: 0x7f5778b331c0 - middle::typeck::check_crate::hebc5712fc1ce4f98yqp
16: 0x7f5778b9b920 - driver::driver::phase_3_run_analysis_passes::h2cf4a6b5389ca85dH9B
17: 0x7f5778b967b0 - driver::driver::compile_input::ha5985a7132f80281sQB
18: 0x7f5778c1dc80 - <unknown>
19: 0x7f5778c1db70 - <unknown>
20: 0x7f577831ed50 - <unknown>
21: 0x7f577831eb40 - <unknown>
22: 0x7f5779476a50 - <unknown>
23: 0x7f5777f71aa0 - <unknown>
24: 0x7f5777f71a90 - rust_try
25: 0x7f5777f1a4a0 - unwind::try::hc67b053bd2fd85bdmYc
26: 0x7f5777f1a330 - task::Task::run::hc35eeb0af3f2ee13u4b
27: 0x7f5779476790 - <unknown>
28: 0x7f5777f1bb40 - <unknown>
29: 0x7f5773096fe0 - start_thread
30: 0x7f5777bedc99 - __clone
31: 0x0 - <unknown>
Version:
rustc --version=verbose
rustc 0.13.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev