title: Returning iterator of a Vec in a RefCell
body: <p>Given the following <code>struct</code> and <code>impl</code>:</p>
  
  <pre><code>use std::slice::Iter;
  use std::cell::RefCell;
  
  struct Foo {
      bar: RefCell&lt;Vec&lt;u32&gt;&gt;,
  }
  
  impl Foo {
      pub fn iter(&amp;self) -&gt; Iter&lt;u32&gt; {
          self.bar.borrow().iter()
      }
  }
  
  fn main() {}
  </code></pre>
  
  <p>I get an error message about a lifetime issue:</p>
  
  <pre class="lang-none prettyprint-override"><code>error: borrowed value does not live long enough
    --&gt; src/main.rs:9:9
     |
  9  |         self.bar.borrow().iter()
     |         ^^^^^^^^^^^^^^^^^ does not live long enough
  10 |     }
     |     - temporary value only lives until here
     |
  note: borrowed value must be valid for the anonymous lifetime #1 defined on the body at 8:36...
    --&gt; src/main.rs:8:37
     |
  8  |       pub fn iter(&amp;self) -&gt; Iter&lt;u32&gt; {
     |  _____________________________________^ starting here...
  9  | |         self.bar.borrow().iter()
  10 | |     }
     | |_____^ ...ending here
  </code></pre>
  
  <p>How am I able to return and use <code>bar</code>s iterator?</p>