The trait bound is not satisfied
<p><a href="https://github.com/rustcc/coroutine-rs/blob/master/src/asymmetric.rs" rel="noreferrer">Coroutine-rs</a></p>

<p>This is the function I am trying to call:</p>

<pre><code>#[inline]
pub fn spawn&lt;F&gt;(f: F) -&gt; Handle
    where F: FnOnce(&amp;mut Coroutine) + Send + 'static
{
    Self::spawn_opts_impl(Box::new(f), Options::default())
}
</code></pre>

<p>I then created an enum because I actually want to send it from one thread to another, which is also why I have boxed the function. I have also matched the trait constraints.</p>

<pre><code>enum Message {
    Task(Box&lt;FnOnce(&amp;mut Coroutine) + Send + 'static&gt;),
}
</code></pre>

<p>But if I try to extract the function from a <code>Message</code>:</p>

<pre><code>fn main(){
    let m = Message::Task(Box::new(|me| {
    }));
    let c = match m{
        Message::Task(f) =&gt; Coroutine::spawn(f)
    };
}
</code></pre>

<p>I get the following error:</p>

<pre class="lang-none prettyprint-override"><code>src/main.rs:168:29: 168:45 error: the trait bound `for&lt;'r&gt; Box&lt;for&lt;'r&gt; std::ops::FnOnce(&amp;'r mut coroutine::asymmetric::Coroutine) + Send&gt;: std::ops::FnOnce&lt;(&amp;'r mut coroutine::asymmetric::Coroutine,)&gt;` is not satisfied [E0277]
src/main.rs:168         Message::Task(f) =&gt; Coroutine::spawn(f)
                                            ^~~~~~~~~~~~~~~~
src/main.rs:168:29: 168:45 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:168:29: 168:45 help: the following implementations were found:
src/main.rs:168:29: 168:45 help:   &lt;Box&lt;std::boxed::FnBox&lt;A, Output=R&gt; + 'a&gt; as std::ops::FnOnce&lt;A&gt;&gt;
src/main.rs:168:29: 168:45 help:   &lt;Box&lt;std::boxed::FnBox&lt;A, Output=R&gt; + Send + 'a&gt; as std::ops::FnOnce&lt;A&gt;&gt;
src/main.rs:168:29: 168:45 note: required by `coroutine::asymmetric::Coroutine::spawn`
</code></pre>

<p>I have no idea what Rust is trying to tell me here. I assume that the problem is that <code>spawn</code> expects a non boxed function, but I get the same error if I try to deref the boxed function.</p>

<p>Note that at the time this question was asked, coroutine-rs doesn't build, and I fixed the errors in <a href="https://github.com/MaikKlein/coroutine-rs" rel="noreferrer">this fork</a>.</p>