r/backtickbot • • Jan 09 '21

https://np.reddit.com/r/KaIT/comments/ktmud8/warum_ich_python_hasse/ginbpz6/

das wäre mir aber neu:

let mut a = vec![1, 2, 3];
let b = a;
a.push(4);
println!("a: {:?}, b: {:?}", a, b);



   2 |     let mut a = vec!\[1, 2, 3\];   
     |         ----- move occurs because \`a\` has type \`Vec<i32>\`, which does not implement the \`Copy\` trait 
   3 |     let b = a;   |             - value moved here 
   4 |     a.push(4);   |     \^ value borrowed here after move
1 Upvotes

0 comments sorted by