Clean up E0515 explanation

This commit is contained in:
Guillaume Gomez 2020-04-11 18:58:03 +02:00
parent 167510f776
commit e2e41c9527

View File

@ -1,7 +1,4 @@
Cannot return value that references local variable
Local variables, function parameters and temporaries are all dropped before the
end of the function body. So a reference to them cannot be returned.
A reference to a local variable was returned.
Erroneous code example:
@ -20,6 +17,9 @@ fn get_dangling_iterator<'a>() -> Iter<'a, i32> {
}
```
Local variables, function parameters and temporaries are all dropped before the
end of the function body. So a reference to them cannot be returned.
Consider returning an owned value instead:
```