Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn get_str() -> &str {
- "Hello World"
- }
- test.rs:1:17: 1:21 error: missing lifetime specifier [E0106]
- test.rs:1 fn get_str() -> &str {
- ^~~~
- test.rs:1:17: 1:21 help: run `rustc --explain E0106` to see a detailed explanation
- 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
- test.rs:1:17: 1:21 help: consider giving it a 'static lifetime
- error: aborting due to previous error
- fn get_str(s: &str) -> &str {
- "Hello World"
- }
- fn get_str(s: &str) -> &str
- fn get_str<'a>(s: &'a str) -> &'a str
- fn get_str() -> &'static str {
- "Hello World"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement