<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(unboxed_closures, unboxed_closure_sugar)]

fn make_adder(a: int, b: int) -&gt; Box&lt;|&amp;:| -&gt; int&gt; {
    (box |&amp;:| a + b) as Box&lt;|&amp;:| -&gt; int&gt;
}

fn main() {
    println!(&quot;{}&quot;, make_adder(1, 2).call(()));
}"><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> unboxed_closure_sugar<span class="pl-kos">)</span><span class="pl-kos">]</span></span>

<span class="pl-k">fn</span> <span class="pl-en">make_adder</span><span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">:</span> <span class="pl-smi">int</span><span class="pl-kos">,</span> <span class="pl-s1">b</span><span class="pl-kos">:</span> <span class="pl-smi">int</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Box</span><span class="pl-kos">&lt;</span>|<span class="pl-c1">&amp;</span><span class="pl-kos">:</span>| -&gt; <span class="pl-smi">int</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-kos">(</span>box |<span class="pl-c1">&amp;</span><span class="pl-kos">:</span>| a + b<span class="pl-kos">)</span> <span class="pl-k">as</span> <span class="pl-smi">Box</span>&lt;|<span class="pl-c1">&amp;</span><span class="pl-kos">:</span>| -&gt; int&gt;
<span class="pl-kos">}</span>

<span class="pl-k">fn</span> main<span class="pl-kos">(</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">"{}"</span>, make_adder<span class="pl-kos">(</span><span class="pl-c1">1</span>, <span class="pl-c1">2</span><span class="pl-kos">)</span>.call<span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This code does not compile with this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:8:42: 8:44 error: mismatched types: expected `()` but found `()` (expected tuple but found ())
&lt;anon&gt;:8     println!(&quot;{}&quot;, make_adder(1, 2).call(()));
                                                  ^~
note: in expansion of format_args!
&lt;std macros&gt;:2:23: 2:77 note: expansion site
&lt;std macros&gt;:1:1: 3:2 note: in expansion of println!
&lt;anon&gt;:8:5: 8:47 note: expansion site
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:8:42: 8:44 error: mismatched types: expected `()` but found `()` (expected tuple but found ())
&lt;anon&gt;:8     println!("{}", make_adder(1, 2).call(()));
                                                  ^~
note: in expansion of format_args!
&lt;std macros&gt;:2:23: 2:77 note: expansion site
&lt;std macros&gt;:1:1: 3:2 note: in expansion of println!
&lt;anon&gt;:8:5: 8:47 note: expansion site
error: aborting due to previous error
</code></pre></div>
<p dir="auto">Naturally, <code class="notranslate">call()</code> without arguments does not work, but I know of no other way to pass zero argument to the closure.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="#![feature(unboxed_closures)]

use std::ops::FnMut;

fn main() {
    let mut zero = |&amp;mut:| {}; zero.call_mut(());

    // let mut one = |&amp;mut: _: int| {}; one.call_mut((1,));
}"><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-k">use</span> std<span class="pl-kos">::</span>ops<span class="pl-kos">::</span><span class="pl-v">FnMut</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> <span class="pl-k">mut</span> zero = |<span class="pl-c1">&amp;</span><span class="pl-k">mut</span><span class="pl-kos">:</span>| <span class="pl-kos">{</span><span class="pl-kos">}</span><span class="pl-kos">;</span> zero<span class="pl-kos">.</span><span class="pl-en">call_mut</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-c">// let mut one = |&amp;mut: _: int| {}; one.call_mut((1,));</span>
<span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:6:46: 6:48 error: mismatched types: expected `()` but found `()` (expected tuple but found ())
&lt;anon&gt;:6     let mut zero = |&amp;mut:| {}; zero.call_mut(());
                                                      ^~"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:6:46: 6:48 error: mismatched types: expected `()` but found `()` (expected tuple but found ())
&lt;anon&gt;:6     let mut zero = |&amp;mut:| {}; zero.call_mut(());
                                                      ^~
</code></pre></div>
<p dir="auto">Swapping the comments compiles fine.</p>
<p dir="auto">(At a guess the compiler is looking for a tuple with no fields, which is not the same as unit <code class="notranslate">()</code>.)</p>