SHARE
TWEET

Untitled

a guest Jun 15th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // move_semantics2.rs
  2. // Make me compile without changing line 10! Scroll down for hints :)
  3.  
  4. fn main() {
  5.     let vec0 = Vec::new();
  6.  
  7.     let mut vec1 = fill_vec(vec0);
  8.  
  9.     // Do not change the following line!
  10.     println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0);
  11.  
  12.     vec1.push(88);
  13.  
  14.     println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
  15.  
  16. }
  17.  
  18. fn fill_vec(vec: Vec<i32>) -> Vec<i32> {
  19.     let mut vec = vec;
  20.  
  21.     vec.push(22);
  22.     vec.push(44);
  23.     vec.push(66);
  24.  
  25.     vec
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top