title: Cannot borrow `*self` as mutable because `self.history[..]` is also borrowed as immutable
body: <p>The code is something like the following, in a function that is an implementation for a <code>Context</code> struct, defined as the following:</p>
  
  <pre><code>struct Context {
      lines: isize,
      buffer: Vec&lt;String&gt;,
      history: Vec&lt;Box&lt;Instruction&gt;&gt;,
  }
  </code></pre>
  
  <p>And the function, of course as an implementation:</p>
  
  <pre><code>fn _execute_history(&amp;mut self, instruction: &amp;Instruction) -&gt; Reaction {
      let num = instruction.suffix.parse::&lt;usize&gt;();
      match num {
          Ok(number) =&gt; {
              match self.history.get(number) {
                  Some(ins) =&gt; { return self.execute(*ins); },
                  _         =&gt; { /* Error handling */ }
              }
          }
          Err(..) =&gt; { /* Error handling */ }
      }
  }
  </code></pre>
  
  <p>This doesn't compile and I don't understand the error message. I searched online for similar problems and I cannot seem to grasp the problem here. I am from a Python background. The full error:</p>
  
  <pre><code>hello.rs:72:23: 72:35 note: previous borrow of `self.history[..]` occurs here; the immutable
  borrow prevents subsequent moves or mutable borrows of `self.history[..]` until the borrow ends
  </code></pre>
  
  <p>I am fully aware that the function is not conforming to the type system, but this is because the simplified code is for demonstrative purposes only.</p>