title: Why can't I store a value and a reference to that value in the same struct?
body: <p>I have a value and I want to store that value and a reference to
  something inside that value in my own type:</p>
  
  <pre><code>struct Thing {
      count: u32,
  }
  
  struct Combined&lt;'a&gt;(Thing, &amp;'a u32);
  
  fn make_combined&lt;'a&gt;() -&gt; Combined&lt;'a&gt; {
      let thing = Thing { count: 42 };
  
      Combined(thing, &amp;thing.count)
  }
  </code></pre>
  
  <p>Sometimes, I have a value and I want to store that value and a reference to
  that value in the same structure:</p>
  
  <pre><code>struct Combined&lt;'a&gt;(Thing, &amp;'a Thing);
  
  fn make_combined&lt;'a&gt;() -&gt; Combined&lt;'a&gt; {
      let thing = Thing::new();
  
      Combined(thing, &amp;thing)
  }
  </code></pre>
  
  <p>Sometimes, I'm not even taking a reference of the value and I get the
  same error:</p>
  
  <pre><code>struct Combined&lt;'a&gt;(Parent, Child&lt;'a&gt;);
  
  fn make_combined&lt;'a&gt;() -&gt; Combined&lt;'a&gt; {
      let parent = Parent::new();
      let child = parent.child();
  
      Combined(parent, child)
  }
  </code></pre>
  
  <p>In each of these cases, I get an error that one of the values "does
  not live long enough". What does this error mean?</p>