rust/src/test/compile-fail/block-arg-used-as-lambda-with-illegal-cap.rs

11 lines
232 B
Rust
Raw Normal View History

fn to_lambda1(f: fn@(uint) -> uint) -> fn@(uint) -> uint {
2012-08-01 17:30:05 -07:00
return f;
2011-12-21 08:41:41 -08:00
}
2012-01-23 14:59:00 -08:00
fn to_lambda2(b: fn(uint) -> uint) -> fn@(uint) -> uint {
2012-08-01 17:30:05 -07:00
return to_lambda1({|x| b(x)}); //~ ERROR value may contain borrowed pointers
2011-12-21 08:41:41 -08:00
}
fn main() {
}