Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. fn foo(strings: &(&String, &String)) -> (&str, &str) { (&strings.0, &strings.1) } // You can do this
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error[E0106]: missing lifetime specifier
  14. --> src/main.rs:6:50
  15. |
  16. 6 | fn foo(strings: &(&String, &String)) -> (&str, &str) { (&strings.0, &strings.1) } // You can do this
  17. | ^ expected lifetime parameter
  18. |
  19. = help: this function's return type contains a borrowed value, but the signature does not say which one of `strings`'s 3 lifetimes it is borrowed from
  20.  
  21. error[E0106]: missing lifetime specifier
  22. --> src/main.rs:6:56
  23. |
  24. 6 | fn foo(strings: &(&String, &String)) -> (&str, &str) { (&strings.0, &strings.1) } // You can do this
  25. | ^ expected lifetime parameter
  26. |
  27. = help: this function's return type contains a borrowed value, but the signature does not say which one of `strings`'s 3 lifetimes it is borrowed from
  28.  
  29. error: aborting due to 2 previous errors
  30.  
  31. For more information about this error, try `rustc --explain E0106`.
  32. error: Could not compile `playground`.
  33.  
  34. To learn more, run the command again with --verbose.
  35.  
  36. */
  37.  
  38. /* ~~~~=== stdout ===~~~~
  39.  
  40. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement