Closed
Description
Consider this function:
fn hello() -> &str {
"hello"
}
This gives a help note:
help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider giving it a 'static lifetime
This doesn't demonstrate how to do the syntax. So, if you screw it up:
fn hello() -> '&str {
"hello"
}
(which you are likely to do if you are new because the lifetime syntax is foreign...)
Rust will give a very confusing diagnostic:
error: character literal may only contain one codepoint: '&
--> <anon>:1:15
|>
1 |> fn hello() -> '&str {
|> ^^
This seems like something we could improve.