title: Borrow error when I try to modify last element of a vector
body: <p>I am trying to modify a <code>Vec&lt;i32&gt;</code> by doing <code>thing[thing.len() - 1] = other_thing;</code>. I get an error telling me that I borrowed first a mutable reference, then an immutable one. I could not find a workaround. How to modify last element of a vector in rust.
  Working example: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=a092f6778df0290de7cee1f2321bf175" rel="nofollow noreferrer">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2021&amp;gist=a092f6778df0290de7cee1f2321bf175</a></p>