Skip to content

Instantly share code, notes, and snippets.

@bvssvni
Created February 28, 2014 03:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvssvni/9264525 to your computer and use it in GitHub Desktop.
Save bvssvni/9264525 to your computer and use it in GitHub Desktop.
pub struct Test<'a> {
function: 'a ||
}
fn main() {
let mut parent = Test { function: || () };
{
let x = 42;
let sayhello = || println!("{}", x);
let test = Test { function: sayhello };
// ERROR because 'sayhello' will run out of scope.
parent = test;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment