We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 167510f commit e2e41c9Copy full SHA for e2e41c9
src/librustc_error_codes/error_codes/E0515.md
@@ -1,7 +1,4 @@
1
-Cannot return value that references local variable
2
-
3
-Local variables, function parameters and temporaries are all dropped before the
4
-end of the function body. So a reference to them cannot be returned.
+A reference to a local variable was returned.
5
6
Erroneous code example:
7
@@ -20,6 +17,9 @@ fn get_dangling_iterator<'a>() -> Iter<'a, i32> {
20
17
}
21
18
```
22
19
+Local variables, function parameters and temporaries are all dropped before the
+end of the function body. So a reference to them cannot be returned.
+
23
Consider returning an owned value instead:
24
25
0 commit comments