Skip to content

Instantly share code, notes, and snippets.

@kunigami
Created March 9, 2019 04:32
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 kunigami/28c41c1d9ddba48b48813d67c1235422 to your computer and use it in GitHub Desktop.
Save kunigami/28c41c1d9ddba48b48813d67c1235422 to your computer and use it in GitHub Desktop.
let mut vec1 = vec![1, 2, 3];
{
let vec2 = &vec1;
let vec3 = &vec1;
println!("{} {}", vec2.len(), vec3.len());
// Error: cannot obtain mutable reference once
// other references are in place
let vec4 = &mut vec1;
}
println!("{}", vec1.len());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment