Closed
Description
Hello.
Trying to learn Rust, playing with closures. Compiler asked me to report bug.
Code:
fn main() {
let caller<F> = |f: F|
where F: Fn() -> i32
{
let x = f();
println!("Y {}",x);
return x;
};
caller(bar_handler);
}
fn bar_handler() -> i32 {
println!("zz");
return 5;
}
Error:
cargo run RUST_BACKTRACE=1
Compiling app v0.0.1
src/main.rs:2:6: 2:12 error: internal compiler error: ident only path should have been covered already
src/main.rs:2 let caller<F> = |f: F|
^~~~~~
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 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:129
File /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs
doesn't exist, folder /Users/rustbuild/
too.
In this code I tried to create closure with function as first argument, but can't yet find how to declare it. But it's offtopic :)