mozilla/rust — Issue #1516: Unable to infer closure type
Author: brson
Created: 2012-01-14 06:35:00+00:00
State: open
Labels: bug, typeck

This looks inferrable.

```
fn main() {
let early_error: fn@(str) -> ! = {|msg|
fail
};
}
```

```
../src/test/run-pass/infer-closure.rs:2:38: 4:5 warning: unable to infer kind of closure, defaulting to block
../src/test/run-pass/infer-closure.rs:2 let early_error: fn@(str) -> ! = {|msg|
../src/test/run-pass/infer-closure.rs:3 fail
../src/test/run-pass/infer-closure.rs:4 };
../src/test/run-pass/infer-closure.rs:2:38: 4:5 error: mismatched types: expected `fn@(++str) -> !` but found `fn&() -> ` (types differ)
../src/test/run-pass/infer-closure.rs:2 let early_error: fn@(str) -> ! = {|msg|
../src/test/run-pass/infer-closure.rs:3 fail
../src/test/run-pass/infer-closure.rs:4 };
../src/test/run-pass/infer-closure.rs:2:38: 4:5 error: cannot determine a type for this expression
../src/test/run-pass/infer-closure.rs:2 let early_error: fn@(str) -> ! = {|msg|
../src/test/run-pass/infer-closure.rs:3 fail
../src/test/run-pass/infer-closure.rs:4 };
error: aborting due to previous errors
```