title: How to fix the error `self` does not live long enough when creating a new value that references self?
body: <p>I am working in Rust, and I am having some trouble getting the ownership system to work for me.  I want to give <code>child</code> a reference to its <code>parent</code> when the <code>parent</code> creates the <code>child</code>.  Below is the code that I was trying to get working: </p>
  
  <pre><code>struct Child&lt;'a&gt; {
      parent: &amp;'a Parent,
  }
  impl&lt;'a&gt; Child&lt;'a&gt; {
      fn new(parent: &amp;Parent) -&gt; Child {
          Child { parent: &amp;parent }
      }
  }
  
  struct Parent {
      child_count: u32,
  }
  impl Parent {
      fn new() -&gt; Parent {
          Parent { child_count: 0 }
      }
      fn makeChild(&amp;mut self) -&gt; Child {
          self.child_count += 1;
          Child::new(&amp;self)
      }
  }
  
  fn main() {
      let mut parent = Parent::new();
      let child = parent.makeChild();
  }
  </code></pre>
  
  <p>However, I keep getting the following error:</p>
  
  <pre><code>src/main.rs:20:17: 20:21 error: `self` does not live long enough
  src/main.rs:20     Child::new(&amp;self)
  </code></pre>