daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.   let x1 = retorna_string();
  3.   let x2 = x1;
  4.   println!("x1: {}, x2: {}", x1, x2);
  5. }
  6.  
  7. fn retorna_string() -> String {
  8.   return String::from("olá");
  9. }
  10. /*
  11.  --> main.rs:4:30
  12.   |
  13. 3 |   let x2 = x1;
  14.   |       -- value moved here
  15. 4 |   println!("x1: {}, x2: {}", x1, x2);
  16.   |                              ^^ value used here after move
  17.   |
  18.   = note: move occurs because `x1` has type `std::string::String`, which does not implement the `Copy` trait
  19.  
  20. error: aborting due to previous error
  21. */
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
 
Top