Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  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. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement