title: Insert constructed string into Vec in Rust
body: <p>Right now I am writing a program where I am updating a <code>Vec</code> with a string constructed based on conditions in a for loop. A (very contrived) simplified form of what I'm trying to do is the following:</p>
  
  <pre class="lang-rust prettyprint-override"><code>fn main() {
      let mut arr = vec!["_"; 5];
      for (i, chr) in "abcde".char_indices() {
          arr[i] = &amp;chr.to_string().repeat(3);
      }
  }
  </code></pre>
  
  <p>However, I am getting the error <code>temporary value dropped while borrowed</code>. Any pointers on what to do here?</p>