-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
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 :)
Metadata
Metadata
Assignees
Labels
A-closuresArea: Closures (`|…| { … }`)Area: Closures (`|…| { … }`)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️