Skip to content

unexpected callee type - compiler panicked #20862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blairn opened this issue Jan 10, 2015 · 3 comments
Closed

unexpected callee type - compiler panicked #20862

blairn opened this issue Jan 10, 2015 · 3 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@blairn
Copy link

blairn commented Jan 10, 2015

While trying to learn how to return a closure.... I came across this..

fn foo(x: i32) {
        |y| x + y
}

fn main() {
        let x = foo(5)(2);
}

gives....

2:12 error: can't infer the "kind" of the closure, explicitly annotate it. e.g. `|&:| {}`
src/hello_world.rs:2        |y| x + y
                            ^~~~~~~~~
src/hello_world.rs:2:3: 2:12 error: mismatched types: expected `()`, found `closure[src/hello_world.rs:2:3: 2:12]` (expected (), found closure)
src/hello_world.rs:2        |y| x + y
                            ^~~~~~~~~
src/hello_world.rs:6:11: 6:20 error: expected function, found `()`
src/hello_world.rs:6        let x = foo(5)(2);
                                    ^~~~~~~~~
src/hello_world.rs:6:11: 6:17 error: internal compiler error: unexpected callee type ()
src/hello_world.rs:6        let x = foo(5)(2);
                                    ^~~~~~
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:123
@kmcallister kmcallister added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jan 11, 2015
barosl added a commit to barosl/rust that referenced this issue Jan 20, 2015
If a type that cannot be called as a function is called, and the result
is assigned to a variable, the "unexpected callee type" ICE occurs.

Fixes rust-lang#20714.
Fixes rust-lang#20842.
Fixes rust-lang#20862.
@kyledewey
Copy link

Commenting-out the body of foo still results in an ICE.

@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Apr 3, 2015
@nikomatsakis
Copy link
Contributor

I can't seem to produce an ICE no matter what I do.

@bombless
Copy link
Contributor

Those closure kinds info are already gone, so I think many related bugs are gone as well.
e.g. I cannot reproduce a bug related to closure kinds and macro #21087

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants