Skip to content

Instantly share code, notes, and snippets.

@kenzan100
Last active December 5, 2016 17:52
Show Gist options
  • Save kenzan100/9a1c4b84d3219870671e85d5633fa35e to your computer and use it in GitHub Desktop.
Save kenzan100/9a1c4b84d3219870671e85d5633fa35e to your computer and use it in GitHub Desktop.
fn use_v() {
let v = make_v();
print_v(v); // error! use of moved value: `v`
print_v(v); // value used here after move
}
fn print_v(v: Vec<i32>) {
println!("{}", v[0]);
}
fn make_v() -> Vec<i32> {
let v = vec![2, 4];
v
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment