Advertisement
Guest User

Untitled

a guest
May 19th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. let a = [1u8, 2, 3]; &a[3..]
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error[E0597]: `a` does not live long enough
  14. --> src/main.rs:6:31
  15. |
  16. 5 | println!("{:?}", {
  17. | ______________________-
  18. 6 | | let a = [1u8, 2, 3]; &a[3..]
  19. | | ^ borrowed value does not live long enough
  20. 7 | | });
  21. | | -
  22. | | |
  23. | |_____`a` dropped here while still borrowed
  24. | borrow later used here
  25.  
  26. error: aborting due to previous error
  27.  
  28. For more information about this error, try `rustc --explain E0597`.
  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