title: Rust 'cannot infer an appropriate lifetime due to conflicting requirements (E0495)'
body: <p>The exact error from my minimal reproducible example:</p>
  
  <pre><code>cannot infer an appropriate lifetime due to conflicting requirements
  
  note: ...so that the types are compatible:
        expected &amp;test_struct
           found &amp;test_struct
  note: but, the lifetime must be valid for the static lifetime...rustc(E0495)
  </code></pre>
  
  <p>I get this error in a much larger project as I was trying to thread calls to a function of a struct.</p>
  
  <p>Here's the code that is a minimal reproducible example, producing the same error:</p>
  
  <pre><code>use std::thread;
  
  pub struct test_struct {}
  
  impl test_struct {
      fn inner_test_fn(&amp;self) -&gt; u32 {
          return 4u32;
      }
      pub fn outer_test_fn(&amp;self) -&gt; u32 {
          let mut threads = vec![];
          let mut total = 0u32;
          for i in 0..4 {
              threads.push(thread::spawn(move || {
                  let out = self.inner_test_fn();
                  total += out;
              }));
          }
          for thread in threads {
              thread.join();
          }
          return total;
      }
  }
  
  fn main() {
      let struct_holder = test_struct{};
      let x = struct_holder.outer_test_fn();
  }
  </code></pre>
  
  <p>I am almost certain the error is because of <code>self.inner_test_fn();</code> but after this point I'm at a loss.</p>
  
  <p>I have and am looking up and reading more about lifetimes right now, but I can't quite figure this out yet.</p>
  
  <p>I am aware of other questions around the same error, but both questions and answers to these are far more complex and difficult to understand than my simple example.</p>
  
  <p>Any help would be greatly appreciated.</p>