Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. "hi" + "hey"
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error[E0369]: binary operation `+` cannot be applied to type `&str`
  14. --> src/main.rs:6:14
  15. |
  16. 6 | "hi" + "hey"
  17. | ---- ^ ----- &str
  18. | | |
  19. | | `+` can't be used to concatenate two `&str` strings
  20. | &str
  21. help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
  22. |
  23. 6 | "hi".to_owned() + "hey"
  24. | ^^^^^^^^^^^^^^^
  25.  
  26. error: aborting due to previous error
  27.  
  28. For more information about this error, try `rustc --explain E0369`.
  29. error: Could not compile `playground`.
  30.  
  31. To learn more, run the command again with --verbose.
  32.  
  33. */
  34.  
  35. /* ~~~~=== stdout ===~~~~
  36.  
  37. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement