@@ -506,25 +506,25 @@ pub enum BorrowKind {
506
506
/// implicit closure bindings. It is needed when the closure is
507
507
/// borrowing or mutating a mutable referent, e.g.:
508
508
///
509
- /// let x: &mut isize = ...;
510
- /// let y = || *x += 5;
509
+ /// let x: &mut isize = ...;
510
+ /// let y = || *x += 5;
511
511
///
512
512
/// If we were to try to translate this closure into a more explicit
513
513
/// form, we'd encounter an error with the code as written:
514
514
///
515
- /// struct Env { x: & &mut isize }
516
- /// let x: &mut isize = ...;
517
- /// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
518
- /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
515
+ /// struct Env { x: & &mut isize }
516
+ /// let x: &mut isize = ...;
517
+ /// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
518
+ /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
519
519
///
520
520
/// This is then illegal because you cannot mutate an `&mut` found
521
521
/// in an aliasable location. To solve, you'd have to translate with
522
522
/// an `&mut` borrow:
523
523
///
524
- /// struct Env { x: & &mut isize }
525
- /// let x: &mut isize = ...;
526
- /// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
527
- /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
524
+ /// struct Env { x: & &mut isize }
525
+ /// let x: &mut isize = ...;
526
+ /// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
527
+ /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
528
528
///
529
529
/// Now the assignment to `**env.x` is legal, but creating a
530
530
/// mutable pointer to `x` is not because `x` is not mutable. We
0 commit comments