From dea47f4ac8eca2db960a71da6f9e9775bf2dd221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maja=20K=C4=85dzio=C5=82ka?= Date: Tue, 25 Feb 2025 14:38:10 +0100 Subject: [PATCH] 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. --- src/types/closure.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/types/closure.md b/src/types/closure.md index 92da4f885..f9719d00b 100644 --- a/src/types/closure.md +++ b/src/types/closure.md @@ -54,9 +54,7 @@ so that the call to `f` works as if it were: ```rust,ignore -// Note: This is not valid Rust due to the duplicate mutable borrows. -// This is only provided as an illustration. -f(Closure{ left_top: &mut rect.left_top, right_bottom_x: &mut rect.left_top.x }); +f(Closure{ left_top: &mut rect.left_top, right_bottom_x: &mut rect.right_bottom.x }); ``` r[type.closure.capture]