@@ -462,10 +462,13 @@ reference, as in the following example:
462462``` rust
463463let mut b = false ;
464464let x = & mut b ;
465- let c = || { * x = true ; };
466- // The following line is an error:
467- // let y = &x;
468- c ();
465+ {
466+ let mut c = || { * x = true ; };
467+ // The following line is an error:
468+ // let y = &x;
469+ c ();
470+ }
471+ let z = & x ;
469472```
470473
471474In this case, borrowing ` x ` mutably is not possible, because ` x ` is not ` mut ` .
@@ -474,7 +477,8 @@ because a `& &mut` reference may not be unique, so it cannot safely be used to
474477modify a value. So a unique immutable borrow is used: it borrows ` x ` immutably,
475478but like a mutable borrow, it must be unique. In the above example, uncommenting
476479the declaration of ` y ` will produce an error because it would violate the
477- uniqueness of the closure's borrow of ` x ` .
480+ uniqueness of the closure's borrow of ` x ` ; the declaration of z is valid because
481+ the closure's lifetime has expired at the end of the block, releasing the borrow.
478482
479483### Call traits and coercions
480484
@@ -524,12 +528,12 @@ of cloning of the captured variables is left unspecified.
524528Because captures are often by reference, the following general rules arise:
525529
526530* A closure is [ ` Sync ` ] if all captured variables are [ ` Sync ` ] .
527- * A closure is [ ` Send ` ] if all variables captured by shared reference are
528- [ ` Sync ` ] , and all values captured by mutable reference, copy, or move are
529- [ ` Send ` ] .
531+ * A closure is [ ` Send ` ] if all variables captured by non-unique immutable
532+ reference are [ ` Sync ` ] , and all values captured by unique immutable or mutable
533+ reference, copy, or move are [ ` Send ` ] .
530534* A closure is [ ` Clone ` ] or [ ` Copy ` ] if it does not capture any values by
531- mutable reference, and if all values it captures by copy or move are
532- [ ` Clone ` ] or [ ` Copy ` ] , respectively.
535+ unique immutable or mutable reference, and if all values it captures by copy
536+ or move are [ ` Clone ` ] or [ ` Copy ` ] , respectively.
533537
534538## Trait objects
535539
0 commit comments