about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-07 00:31:38 +0200
committerGitHub <noreply@github.com>2020-04-07 00:31:38 +0200
commit7500bcfbb21857c7d751fec31beee5931452ba34 (patch)
tree97b0e031c50032adec76e142d8a980402a560521 /src/librustc_error_codes/error_codes
parent5768385615c61f6c9d63dccfb3548812f1ba1320 (diff)
parent84c97ee9a0d445f48982f5e9cd5e2b3e5c266ee5 (diff)
downloadrust-7500bcfbb21857c7d751fec31beee5931452ba34.tar.gz
rust-7500bcfbb21857c7d751fec31beee5931452ba34.zip
Rollup merge of #70690 - GuillaumeGomez:cleanup-e0501, r=Dylan-DPC
Clean up E0501 explanation

r? @Dylan-DPC
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0501.md20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/librustc_error_codes/error_codes/E0501.md b/src/librustc_error_codes/error_codes/E0501.md
index f5aa17a8094..ffdbc443905 100644
--- a/src/librustc_error_codes/error_codes/E0501.md
+++ b/src/librustc_error_codes/error_codes/E0501.md
@@ -1,12 +1,4 @@
-This error indicates that a mutable variable is being used while it is still
-captured by a closure. Because the closure has borrowed the variable, it is not
-available for use until the closure goes out of scope.
-
-Note that a capture will either move or borrow a variable, but in this
-situation, the closure is borrowing the variable. Take a look at the chapter
-on [Capturing][capturing] in Rust By Example for more information.
-
-[capturing]: https://doc.rust-lang.org/stable/rust-by-example/fn/closures/capture.html
+A mutable variable is used but it is already captured by a closure.
 
 Erroneous code example:
 
@@ -29,6 +21,16 @@ fn foo(a: &mut i32) {
 }
 ```
 
+This error indicates that a mutable variable is used while it is still captured
+by a closure. Because the closure has borrowed the variable, it is not available
+until the closure goes out of scope.
+
+Note that a capture will either move or borrow a variable, but in this
+situation, the closure is borrowing the variable. Take a look at the chapter
+on [Capturing][capturing] in Rust By Example for more information.
+
+[capturing]: https://doc.rust-lang.org/stable/rust-by-example/fn/closures/capture.html
+
 To fix this error, you can finish using the closure before using the captured
 variable: