fn ownership_demo() {
let v = vec![1,2,3,4];
work_on_vector(v);
- /* println!("The first element is: {}", v[0]); */
+ /* println!("The first element is: {}", v[0]); */ /* BAD! */
}
// ## Shared borrowing
/* let first = &v[0]; */
vec_inc(&mut v);
vec_inc(&mut v);
- /* println!("The first element is: {}", *first); */
+ /* println!("The first element is: {}", *first); */ /* BAD! */
}
// ## Summary