Skip to content

Commit

Permalink
Rollup merge of #72137 - GuillaumeGomez:cleanup-e0581, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Clean up E0581 explanation

r? @Dylan-DPC
  • Loading branch information
RalfJung committed May 14, 2020
2 parents 577da45 + 61fbe57 commit 0b8b38c
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 0b8b38c

Please sign in to comment.