Closed
Description
fn foo<U>(t: U) {
let y = t();
}
pub fn main() {
foo(|| { 1 });
}
results in
a.rs:2:13: 2:16 error: expected function, found `U`
a.rs:2 let y = t();
^~~
a.rs:2:13: 2:14 error: internal compiler error: unexpected callee type U
a.rs:2 let y = t();
^
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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libsyntax/diagnostic.rs:130
stack backtrace:
1: 0x7f7bc5e2baf0 - sys::backtrace::write::ha1285e6ad7009234SZt
2: 0x7f7bc5e4dd60 - failure::on_fail::he2e581bffa6b3e43LdA
3: 0x7f7bc5dbc3b0 - rt::unwind::begin_unwind_inner::hc22dd6e06baffeb3MSz
4: 0x7f7bc088fdf0 - rt::unwind::begin_unwind::h14850417801730860199
5: 0x7f7bc088fd80 - diagnostic::SpanHandler::span_bug::hbc0c71c406307e37pYE
6: 0x7f7bc3d2b9e0 - session::Session::span_bug::he2ec64c2aee7f362Dvo
7: 0x7f7bc4e746d0 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_expr::h2143755726639606175
8: 0x7f7bc4e741e0 - middle::expr_use_visitor::ExprUseVisitor<'d, 't, 'tcx, TYPER>::walk_block::h5005916935757248939
9: 0x7f7bc4e6d420 - check::upvar::AdjustBorrowKind<'a, 'tcx>::analyze_fn::h825315706994f0e2IQi
10: 0x7f7bc4ea2840 - check::check_bare_fn::h600d15d87e34ca1bD4k
11: 0x7f7bc4e9a0d0 - check::check_item::h275b30ae4fb9b22fgnl
12: 0x7f7bc4f69720 - check_crate::unboxed_closure.31998
13: 0x7f7bc4f64200 - check_crate::h5aacfae0580e6668NMy
14: 0x7f7bc6393fe0 - driver::phase_3_run_analysis_passes::h82ada0cbeb74109bVFa
15: 0x7f7bc637c030 - driver::compile_input::hf24449271908df73Bba
16: 0x7f7bc643f420 - run_compiler::hd7bb31ad4d130831R8b
17: 0x7f7bc643db90 - thunk::F.Invoke<A, R>::invoke::h8032505569135520355
18: 0x7f7bc643caf0 - rt::unwind::try::try_fn::h5190150401514006474
19: 0x7f7bc5eb9600 - rust_try_inner
20: 0x7f7bc5eb95f0 - rust_try
21: 0x7f7bc643cda0 - thunk::F.Invoke<A, R>::invoke::h18133957152747329837
22: 0x7f7bc5e3ba00 - sys::thread::thread_start::h9000ab048e180f84aPw
23: 0x7f7bc00b0250 - start_thread
24: 0x7f7bc5a51219 - clone
25: 0x0 - <unknown>
Version info:
rustc 1.0.0-nightly (4be79d6ac 2015-01-23 16:08:14 +0000)
binary: rustc
commit-hash: 4be79d6acde9eed3a9b5281a46f385bcb4ce736c
commit-date: 2015-01-23 16:08:14 +0000
host: x86_64-unknown-linux-gnu
release: 1.0.0-nightly