rust/src/test/compile-fail/regions-escape-bound-fn-2.rs

11 lines
193 B
Rust
Raw Normal View History

fn with_int(f: fn(x: &int)) {
let x = 3;
f(&x);
}
fn main() {
2012-08-20 12:23:37 -07:00
let mut x = None;
//~^ ERROR reference is not valid outside of its lifetime
2012-08-20 12:23:37 -07:00
with_int(|y| x = Some(y));
}