-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.