title: "Cannot move out of dereference `&`-pointer" with a vector
body: <p>I'm experimenting with Rust right now, and I'm getting really tripped up by all sorts of random compiler errors like this one:</p>
  
  <pre><code>error: cannot move out of dereference of `&amp;`-pointer
      return list[idx];
             ^~~~~~~~~
  </code></pre>
  
  <p>The snippet in question is reproduced below. list is a word list, and the idea is to return a random word from list which is within a certain length (between minLength and maxLength). So, I generate a random uint and constrain it to the size of the list using a modulo. Then I want to check to see if that word is the right length, and if it is return it.</p>
  
  <p>Obviously this isn't the most efficient way to do this, but I just wanted something easy that would fulfill the needs of the exercise.</p>
  
  <pre><code>fn get_a_word(list: Vec&lt;String&gt;, minLength: uint, maxLength: uint) -&gt; String {
      loop {
          let idx = rand::random::&lt;uint&gt;() % list.len();
          if list[idx].len() &gt; minLength &amp;&amp; list[idx].len() &lt; maxLength {
              return list[idx];
          }
      }
  }
  </code></pre>
  
  <p>I've done some research into what this error message means, but everyone seems to say that this  comes up when you're dealing with <code>Option&lt;T&gt;</code> retvals, not attempting to get the value out of a collection.</p>
  
  <p>This is probably a really simple question, but why on earth doesn't Rust just let you return a value from a collection/vector/array?</p>