rust/src/test/compile-fail/issue-2149.rs

11 lines
281 B
Rust
Raw Normal View History

impl monad<A> for ~[A] {
fn bind<B>(f: fn(A) -> ~[B]) {
let mut r = fail;
2012-07-01 01:19:07 +02:00
for self.each |elt| { r += f(elt); }
//~^ WARNING unreachable expression
//~^^ ERROR the type of this value must be known
}
}
fn main() {
["hi"].bind({|x| [x] });
}