title: Same lifetime parameter for all fields of a struct
body: <p>Here is the code:</p>
  
  <pre><code>#[derive(Debug)]
  struct Foo {
      f: i32,
  }
  
  #[derive(Debug)]
  struct Bar&lt;'a&gt; {
      bar1: &amp;'a Foo,
      bar2: &amp;'a Foo,
  }
  
  #[allow(unused_variables)]
  fn make_bar&lt;'a&gt;(foo1: &amp;'a Foo, foo2: &amp;'a Foo) -&gt; Bar&lt;'a&gt; {
      Bar {
          bar1: foo1,
          bar2: foo2,
      }
  }
  
  fn extract_bar2&lt;'a&gt;(foo: &amp;'a Foo) -&gt; &amp;'a Foo {
      let foo1 = Foo { f: 22 };
      let foo2 = make_bar(&amp;foo, &amp;foo1).bar1;
      foo2
  }
  
  fn main() {
      let foo = Foo { f: 11 };
      let foo1 = extract_bar2(&amp;foo);
      println!("foo1: {:?}", foo1);
  }
  </code></pre>
  
  <p>This gives an error:</p>
  
  <pre class="lang-none prettyprint-override"><code>error: `foo1` does not live long enough
    --&gt; src/main.rs:23:32
     |&gt;
  23 |&gt;     let foo2 = make_bar(&amp;foo, &amp;foo1).bar1;
     |&gt;                                ^^^^
  note: reference must be valid for the lifetime 'a as defined on the block at 21:45...
    --&gt; src/main.rs:21:46
     |&gt;
  21 |&gt; fn extract_bar2&lt;'a&gt;(foo: &amp;'a Foo) -&gt; &amp;'a Foo {
     |&gt;                                              ^
  note: ...but borrowed value is only valid for the block suffix following statement 0 at 22:29
    --&gt; src/main.rs:22:30
     |&gt;
  22 |&gt;     let foo1 = Foo { f: 22 };
     |&gt;                              ^
  </code></pre>
  
  <p>The core question is: What does a lifetime parameter actually means in the context of a struct? </p>
  
  <p>More specifically: What are the consequences of having the same lifetime parameter for all fields of a struct? Do their lifetimes have to be exactly the same? Do they have to overlap? If so to what extent should they overlap?</p>
  
  <p>What are the (semantic and practical) differences between the following two structs?</p>
  
  <pre><code>struct Bar&lt;'b&gt; {
      bar1: &amp;'b Foo,
      bar2: &amp;'b Foo,
  }
  struct Bar&lt;'a, 'b&gt; {
      bar1: &amp;'a Foo,
      bar2: &amp;'b Foo,
  }
  </code></pre>