Rollup merge of #72137 - GuillaumeGomez:cleanup-e0581, r=Dylan-DPC
Clean up E0581 explanation r? @Dylan-DPC
This commit is contained in:
commit
0b8b38c4c2
@ -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:
|
||||
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user