Skip to content

Commit

Permalink
Rollup merge of rust-lang#72137 - GuillaumeGomez:cleanup-e0581, r=Dyl…
Browse files Browse the repository at this point in the history
…an-DPC

Clean up E0581 explanation

r? @Dylan-DPC
  • Loading branch information
Dylan-DPC committed May 13, 2020
2 parents 68cd0d2 + 61fbe57 commit ab220b0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/librustc_error_codes/error_codes/E0581.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
In a `fn` type, a lifetime appears only in the return type,
In a `fn` type, a lifetime appears only in the return type
and not in the arguments types.

Erroneous code example:
Expand All @@ -10,8 +10,11 @@ fn main() {
}
```

To fix this issue, either use the lifetime in the arguments, or use
`'static`. Example:
The problem here is that the lifetime isn't contrained by any of the arguments,
making it impossible to determine how long it's supposed to live.

To fix this issue, either use the lifetime in the arguments, or use the
`'static` lifetime. Example:

```
fn main() {
Expand Down

0 comments on commit ab220b0

Please sign in to comment.