Skip to content

Commit

Permalink
Clean up E0581 explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed May 12, 2020
1 parent 97f3eee commit 61fbe57
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 61fbe57

Please sign in to comment.