File tree 1 file changed +11
-9
lines changed
src/librustc_error_codes/error_codes
1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 1
- This error indicates that a mutable variable is being used while it is still
2
- captured by a closure. Because the closure has borrowed the variable, it is not
3
- available for use until the closure goes out of scope.
4
-
5
- Note that a capture will either move or borrow a variable, but in this
6
- situation, the closure is borrowing the variable. Take a look at the chapter
7
- on [ Capturing] [ capturing ] in Rust By Example for more information.
8
-
9
- [ capturing ] : https://doc.rust-lang.org/stable/rust-by-example/fn/closures/capture.html
1
+ A mutable variable is used but it is already captured by a closure.
10
2
11
3
Erroneous code example:
12
4
@@ -29,6 +21,16 @@ fn foo(a: &mut i32) {
29
21
}
30
22
```
31
23
24
+ This error indicates that a mutable variable is used while it is still captured
25
+ by a closure. Because the closure has borrowed the variable, it is not available
26
+ until the closure goes out of scope.
27
+
28
+ Note that a capture will either move or borrow a variable, but in this
29
+ situation, the closure is borrowing the variable. Take a look at the chapter
30
+ on [ Capturing] [ capturing ] in Rust By Example for more information.
31
+
32
+ [ capturing ] : https://doc.rust-lang.org/stable/rust-by-example/fn/closures/capture.html
33
+
32
34
To fix this error, you can finish using the closure before using the captured
33
35
variable:
34
36
You can’t perform that action at this time.
0 commit comments