Advertisement
cwchen

[Rust] Moved vector (with error)

Aug 27th, 2017
507
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rust 0.15 KB | None | 0 0
  1. fn main() {
  2.     let v = vec![1, 2, 3];
  3.  
  4.     // Vector moved from v to v1
  5.     let v1 = v;
  6.  
  7.     // Error when accessing v
  8.     println!("{}", v[1]);
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement