Created
March 9, 2019 02:52
-
-
Save kunigami/ee3f83fa396e1d8a158bdedfe8e32484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn mutate_vec(mut vec: Vec<i32>) -> Vec<i32> { | |
vec.push(4); | |
} | |
let mut vec1 = vec![1, 2, 3]; | |
mutate_vec(vec1); | |
// Error: ownership transferred in function call | |
println!("{}", vec1.len()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment