Skip to content

Commit dea47f4

Browse files
authored
Closures: fix example of desugaring
Passing `left_top.x` into `right_bottom_x`. This invalidates the comment being made. In fact, the closure lowering doesn't have any special borrow checking rules that would allow it to have two overlapping mutable borrows.
1 parent 615b4ce commit dea47f4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/types/closure.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ so that the call to `f` works as if it were:
5454

5555
<!-- ignore: continuation of above -->
5656
```rust,ignore
57-
// Note: This is not valid Rust due to the duplicate mutable borrows.
58-
// This is only provided as an illustration.
59-
f(Closure{ left_top: &mut rect.left_top, right_bottom_x: &mut rect.left_top.x });
57+
f(Closure{ left_top: &mut rect.left_top, right_bottom_x: &mut rect.right_bottom.x });
6058
```
6159

6260
r[type.closure.capture]

0 commit comments

Comments
 (0)