Closed
Description
When I compile this:
type Cb<'self> = 'self |buf: &[u8]| -> bool;
// type Cb = proc(&[u8]) -> bool; // Works with this.
fn bug(cb: Cb) -> bool
{
let arg = "hello";
cb(arg.as_bytes())
}
fn main()
{
do bug |s| {
true
};
}
Rust output this:
rustc -o bug bug.rs
bug.rs:12:7: 14:5 error: last argument in `do` call has non-procedure type: |&[u8]| -> bool
bug.rs:12 do bug |s| {
bug.rs:13 true
bug.rs:14 };
task 'rustc' failed at 'assertion failed: !ty::type_needs_infer(ty)', /build/rust-git/src/rust/src/librustc/middle/typeck/mod.rs:241
error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler.
We would appreciate a bug report: https://github.com/mozilla/rust/wiki/HOWTO-submit-a-Rust-bug-report
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1 to get further details and report the results to github.com/mozilla/rust/issues
task '<main>' failed at 'explicit failure', /build/rust-git/src/rust/src/librustc/lib.rs:395
Makefile:6: recipe for target 'bug' failed
make: *** [bug] Error 101
This seems to me to be a lack of type checking, but I'm not sure.
PS: I'm using latest nightly Rust build from thestinger Arch repo.