Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. #![allow(unreachable_code)]
  2.  
  3.  
  4. fn main() {
  5. println!("{:?}", {
  6. fn quote(path: &std::path::Path) -> String { unimplemented!() } let path = std::path::PathBuf::new(); let mut quoted_path = None; let get_quoted_path = || quoted_path.get_or_insert_with(|| quote(&path)); get_quoted_path();
  7. });
  8. }
  9.  
  10.  
  11. /* ~~~~=== stderr ===~~~~
  12. Compiling playground v0.0.1 (/playground)
  13. error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
  14. --> src/main.rs:6:176
  15. |
  16. 6 | fn quote(path: &std::path::Path) -> String { unimplemented!() } let path = std::path::PathBuf::new(); let mut quoted_path = None; let get_quoted_path = || quoted_path.get_or_insert_with(|| quote(&path)); get_quoted_path();
  17. | ^^^^^^^^^^^^^^^^^^
  18. |
  19. note: first, the lifetime cannot outlive the lifetime as defined on the body at 6:161...
  20. --> src/main.rs:6:161
  21. |
  22. 6 | fn quote(path: &std::path::Path) -> String { unimplemented!() } let path = std::path::PathBuf::new(); let mut quoted_path = None; let get_quoted_path = || quoted_path.get_or_insert_with(|| quote(&path)); get_quoted_path();
  23. | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  24. note: ...so that closure can access `quoted_path`
  25. --> src/main.rs:6:164
  26. |
  27. 6 | fn quote(path: &std::path::Path) -> String { unimplemented!() } let path = std::path::PathBuf::new(); let mut quoted_path = None; let get_quoted_path = || quoted_path.get_or_insert_with(|| quote(&path)); get_quoted_path();
  28. | ^^^^^^^^^^^
  29. note: but, the lifetime must be valid for the call at 6:213...
  30. --> src/main.rs:6:213
  31. |
  32. 6 | fn quote(path: &std::path::Path) -> String { unimplemented!() } let path = std::path::PathBuf::new(); let mut quoted_path = None; let get_quoted_path = || quoted_path.get_or_insert_with(|| quote(&path)); get_quoted_path();
  33. | ^^^^^^^^^^^^^^^^^
  34. note: ...so type `&mut std::string::String` of expression is valid during the expression
  35. --> src/main.rs:6:213
  36. |
  37. 6 | fn quote(path: &std::path::Path) -> String { unimplemented!() } let path = std::path::PathBuf::new(); let mut quoted_path = None; let get_quoted_path = || quoted_path.get_or_insert_with(|| quote(&path)); get_quoted_path();
  38. | ^^^^^^^^^^^^^^^^^
  39.  
  40. error: aborting due to previous error
  41.  
  42. For more information about this error, try `rustc --explain E0495`.
  43. error: Could not compile `playground`.
  44.  
  45. To learn more, run the command again with --verbose.
  46.  
  47. */
  48.  
  49. /* ~~~~=== stdout ===~~~~
  50.  
  51. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement