]> git.lizzy.rs Git - rust.git/commitdiff
Clean up E0515 explanation
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 11 Apr 2020 16:58:03 +0000 (18:58 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sat, 11 Apr 2020 16:58:03 +0000 (18:58 +0200)
src/librustc_error_codes/error_codes/E0515.md

index 9580b6f92acd1bd77188397cbf62bc29576ff0d0..0f4fbf672239c83c6ad8e6e73f918f43586e7a79 100644 (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:
 
 ```