<p dir="auto">It is either very hard (I don't know how to do it) or impossible to create an unboxed closure that takes a mutable reference. Here are my attempts, with the resulting error messages inline:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(unboxed_closures)]
#![feature(overloaded_calls)]

// test.rs:4:23: 4:31 error: missing lifetime specifier [E0106]
// test.rs:4 fn doit&lt;T, F: FnOnce&lt;(&amp;mut int,), T&gt;&gt;(f: F) -&gt; T {
//                                 ^~~~~~~~
// error: aborting due to previous error
fn doit&lt;T, F: FnOnce&lt;(&amp;mut int,), T&gt;&gt;(f: F) -&gt; T {
  let x = 4;
  f(&amp;mut x,)
}

fn main() {
  let r: int = doit(|: i: &amp;mut int| i + 1);
  println!(&quot;x = {}&quot;, r);
}

/////////////////////////////////////////////////////////////////////////

#![feature(unboxed_closures)]
#![feature(overloaded_calls)]

fn doit&lt;'a, T, F: FnOnce&lt;(&amp;'a mut int,), T&gt;&gt;(f: F) -&gt; T {
  let x = 4;
// test.rs:26:10: 26:11 error: `x` does not live long enough
// test.rs:26   f(&amp;mut x,)
//                     ^
// test.rs:24:57: 27:2 note: reference must be valid for the lifetime 'a as defined on the block at 24:56...
// test.rs:24 fn doit&lt;'a, T, F: FnOnce&lt;(&amp;'a mut int,), T&gt;&gt;(f: F) -&gt; T {
// test.rs:25   let x = 4;
// test.rs:26   f(&amp;mut x,)
// test.rs:27 }
// test.rs:24:57: 27:2 note: ...but borrowed value is only valid for the block at 24:56
// test.rs:24 fn doit&lt;'a, T, F: FnOnce&lt;(&amp;'a mut int,), T&gt;&gt;(f: F) -&gt; T {
// test.rs:25   let x = 4;
// test.rs:26   f(&amp;mut x,)
// test.rs:27 }
// error: aborting due to previous error
  f(&amp;mut x,)
}

fn main() {
  let r: int = doit(|: i: &amp;mut int| *i + 1);
  println!(&quot;x = {}&quot;, r);
}"><pre class="notranslate"><span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>unboxed_closures<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>overloaded_calls<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-c">// test.rs:4:23: 4:31 error: missing lifetime specifier [E0106]</span>
<span class="pl-c">// test.rs:4 fn doit&lt;T, F: FnOnce&lt;(&amp;mut int,), T&gt;&gt;(f: F) -&gt; T {</span>
<span class="pl-c">//                                 ^~~~~~~~</span>
<span class="pl-c">// error: aborting due to previous error</span>
<span class="pl-k">fn</span> <span class="pl-en">doit</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">,</span> <span class="pl-smi">F</span><span class="pl-kos">:</span> <span class="pl-smi">FnOnce</span><span class="pl-kos">&lt;</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">int</span><span class="pl-kos">,</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">f</span><span class="pl-kos">:</span> <span class="pl-smi">F</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">T</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> x = <span class="pl-c1">4</span><span class="pl-kos">;</span>
  <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> x<span class="pl-kos">,</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> r<span class="pl-kos">:</span> <span class="pl-smi">int</span> = <span class="pl-en">doit</span><span class="pl-kos">(</span>|<span class="pl-kos">:</span> <span class="pl-s1">i</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">int</span>| i + <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"x = {}"</span>, r<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-c">/////////////////////////////////////////////////////////////////////////</span>

<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>unboxed_closures<span class="pl-kos">)</span><span class="pl-kos">]</span></span>
<span class="pl-c1">#!<span class="pl-kos">[</span>feature<span class="pl-kos">(</span>overloaded_calls<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">fn</span> <span class="pl-en">doit</span><span class="pl-kos">&lt;</span><span class="pl-c1">'</span><span class="pl-ent">a</span><span class="pl-kos">,</span> <span class="pl-smi">T</span><span class="pl-kos">,</span> <span class="pl-smi">F</span><span class="pl-kos">:</span> <span class="pl-smi">FnOnce</span><span class="pl-kos">&lt;</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-c1">'</span><span class="pl-ent">a</span> <span class="pl-k">mut</span> <span class="pl-smi">int</span><span class="pl-kos">,</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-s1">f</span><span class="pl-kos">:</span> <span class="pl-smi">F</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">T</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> x = <span class="pl-c1">4</span><span class="pl-kos">;</span>
<span class="pl-c">// test.rs:26:10: 26:11 error: `x` does not live long enough</span>
<span class="pl-c">// test.rs:26   f(&amp;mut x,)</span>
<span class="pl-c">//                     ^</span>
<span class="pl-c">// test.rs:24:57: 27:2 note: reference must be valid for the lifetime 'a as defined on the block at 24:56...</span>
<span class="pl-c">// test.rs:24 fn doit&lt;'a, T, F: FnOnce&lt;(&amp;'a mut int,), T&gt;&gt;(f: F) -&gt; T {</span>
<span class="pl-c">// test.rs:25   let x = 4;</span>
<span class="pl-c">// test.rs:26   f(&amp;mut x,)</span>
<span class="pl-c">// test.rs:27 }</span>
<span class="pl-c">// test.rs:24:57: 27:2 note: ...but borrowed value is only valid for the block at 24:56</span>
<span class="pl-c">// test.rs:24 fn doit&lt;'a, T, F: FnOnce&lt;(&amp;'a mut int,), T&gt;&gt;(f: F) -&gt; T {</span>
<span class="pl-c">// test.rs:25   let x = 4;</span>
<span class="pl-c">// test.rs:26   f(&amp;mut x,)</span>
<span class="pl-c">// test.rs:27 }</span>
<span class="pl-c">// error: aborting due to previous error</span>
  <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-c1">&amp;</span><span class="pl-k">mut</span> x<span class="pl-kos">,</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> <span class="pl-en">main</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">let</span> r<span class="pl-kos">:</span> <span class="pl-smi">int</span> = <span class="pl-en">doit</span><span class="pl-kos">(</span>|<span class="pl-kos">:</span> <span class="pl-s1">i</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">int</span>| <span class="pl-c1">*</span>i + <span class="pl-c1">1</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-en">println</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"x = {}"</span>, r<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This is on the 1.0 schedule, but there is no issue and no RFC.</p>