@@ -682,25 +682,31 @@ pub enum BorrowKind {
682682 /// implicit closure bindings. It is needed when the closure
683683 /// is borrowing or mutating a mutable referent, e.g.:
684684 ///
685- /// let x: &mut isize = ...;
686- /// let y = || *x += 5;
685+ /// ```
686+ /// let x: &mut isize = ...;
687+ /// let y = || *x += 5;
688+ /// ```
687689 ///
688690 /// If we were to try to translate this closure into a more explicit
689691 /// form, we'd encounter an error with the code as written:
690692 ///
691- /// struct Env { x: & &mut isize }
692- /// let x: &mut isize = ...;
693- /// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
694- /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
693+ /// ```
694+ /// struct Env { x: & &mut isize }
695+ /// let x: &mut isize = ...;
696+ /// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
697+ /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
698+ /// ```
695699 ///
696700 /// This is then illegal because you cannot mutate a `&mut` found
697701 /// in an aliasable location. To solve, you'd have to translate with
698702 /// an `&mut` borrow:
699703 ///
700- /// struct Env { x: & &mut isize }
701- /// let x: &mut isize = ...;
702- /// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
703- /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
704+ /// ```
705+ /// struct Env { x: & &mut isize }
706+ /// let x: &mut isize = ...;
707+ /// let y = (&mut Env { &mut x }, fn_ptr); // changed from &x to &mut x
708+ /// fn fn_ptr(env: &mut Env) { **env.x += 5; }
709+ /// ```
704710 ///
705711 /// Now the assignment to `**env.x` is legal, but creating a
706712 /// mutable pointer to `x` is not because `x` is not mutable. We
0 commit comments