Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. fn get_str() -> &str {
  2. "Hello World"
  3. }
  4.  
  5. test.rs:1:17: 1:21 error: missing lifetime specifier [E0106]
  6. test.rs:1 fn get_str() -> &str {
  7. ^~~~
  8. test.rs:1:17: 1:21 help: run `rustc --explain E0106` to see a detailed explanation
  9. test.rs:1:17: 1:21 help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
  10. test.rs:1:17: 1:21 help: consider giving it a 'static lifetime
  11. error: aborting due to previous error
  12.  
  13. fn get_str(s: &str) -> &str {
  14. "Hello World"
  15. }
  16.  
  17. fn get_str(s: &str) -> &str
  18.  
  19. fn get_str<'a>(s: &'a str) -> &'a str
  20.  
  21. fn get_str() -> &'static str {
  22. "Hello World"
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement