2012-08-13 15:06:13 -07:00
|
|
|
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;
|
2012-08-13 15:06:13 -07:00
|
|
|
//~^ ERROR reference is not valid outside of its lifetime
|
2012-08-20 12:23:37 -07:00
|
|
|
with_int(|y| x = Some(y));
|
2012-08-13 15:06:13 -07:00
|
|
|
}
|