title: Why does this parameter need to have a 'static lifetime bound?
body: <pre class="lang-rust prettyprint-override"><code>use std::future::Future;
  
  struct A;
  
  async fn foo&lt;T, R&gt;(t: T) 
  where 
      T: Fn(&amp;mut A) -&gt; R + Send + Sync + 'static,
      R: Future + Send,
      R::Output: Send
  {
      tokio::spawn(bar(t));
  }
  
  async fn bar&lt;T, R&gt;(t: T) 
  where 
      T: Fn(&amp;mut A) -&gt; R + Send,
      R: Future + Send,
      R::Output: Send
  {
      let mut a = A;
      t(&amp;mut a).await;
  }
  
  </code></pre>
  <p>Playground : <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=e8885b0f86a5b6defcbd2f45d8e35178" rel="nofollow noreferrer">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=e8885b0f86a5b6defcbd2f45d8e35178</a></p>
  <p>My instinct is that R only need to live as long as <code>&amp;mut A</code>. But this is somehow not correct.</p>
  <p>My goal is to provide a function that accept following code</p>
  <pre class="lang-rust prettyprint-override"><code>async fn handle(&amp;mut A) {
    todo!()
  }
  
  async fn main() {
     foo(handle).await
  }
  </code></pre>