<p dir="auto">This,</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/// A binary tree with nodes labelled with `T`
pub struct Tree&lt;T&gt; {
    pub value: T,
    pub left: Option&lt;Box&lt;Tree&lt;T&gt;&gt;&gt;,
    pub right: Option&lt;Box&lt;Tree&lt;T&gt;&gt;&gt;,
}

impl&lt;T&gt; Tree&lt;T&gt; {
    pub fn map_step&lt;F, V&gt;(self, f: &amp;mut FnMut(T) -&gt; V) -&gt; Tree&lt;V&gt; {
        Tree {
            left: self.left.map(|x| { let a: Tree&lt;V&gt; = x.map_step(f);
                                      Box::new(a) }),
            right: self.right.map(|x| Box::new(x.map_step(f))),
            value: f(self.value),
        }
    }
}

fn main() {}"><pre class="notranslate"><span class="pl-c">/// A binary tree with nodes labelled with `T`</span>
<span class="pl-k">pub</span> <span class="pl-k">struct</span> <span class="pl-smi">Tree</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-c1">value</span><span class="pl-kos">:</span> <span class="pl-smi">T</span><span class="pl-kos">,</span>
    <span class="pl-k">pub</span> <span class="pl-c1">left</span><span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">Tree</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span>
    <span class="pl-k">pub</span> <span class="pl-c1">right</span><span class="pl-kos">:</span> <span class="pl-smi">Option</span><span class="pl-kos">&lt;</span><span class="pl-smi">Box</span><span class="pl-kos">&lt;</span><span class="pl-smi">Tree</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span>

<span class="pl-k">impl</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-smi">Tree</span><span class="pl-kos">&lt;</span><span class="pl-smi">T</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">map_step</span><span class="pl-kos">&lt;</span><span class="pl-smi">F</span><span class="pl-kos">,</span> <span class="pl-smi">V</span><span class="pl-kos">&gt;</span><span class="pl-kos">(</span><span class="pl-smi">self</span><span class="pl-kos">,</span> <span class="pl-s1">f</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-k">mut</span> <span class="pl-smi">FnMut</span><span class="pl-kos">(</span><span class="pl-smi">T</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">V</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">Tree</span><span class="pl-kos">&lt;</span><span class="pl-smi">V</span><span class="pl-kos">&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-smi">Tree</span> <span class="pl-kos">{</span>
            <span class="pl-c1">left</span><span class="pl-kos">:</span> <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">left</span><span class="pl-kos">.</span><span class="pl-en">map</span><span class="pl-kos">(</span>|x| <span class="pl-kos">{</span> <span class="pl-k">let</span> a<span class="pl-kos">:</span> <span class="pl-smi">Tree</span><span class="pl-kos">&lt;</span><span class="pl-smi">V</span><span class="pl-kos">&gt;</span> = x<span class="pl-kos">.</span><span class="pl-en">map_step</span><span class="pl-kos">(</span>f<span class="pl-kos">)</span><span class="pl-kos">;</span>
                                      <span class="pl-smi">Box</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span>a<span class="pl-kos">)</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
            <span class="pl-c1">right</span><span class="pl-kos">:</span> <span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">right</span><span class="pl-kos">.</span><span class="pl-en">map</span><span class="pl-kos">(</span>|x| <span class="pl-smi">Box</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span>x<span class="pl-kos">.</span><span class="pl-en">map_step</span><span class="pl-kos">(</span>f<span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
            <span class="pl-c1">value</span><span class="pl-kos">:</span> <span class="pl-en">f</span><span class="pl-kos">(</span><span class="pl-smi">self</span><span class="pl-kos">.</span><span class="pl-c1">value</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-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-kos">}</span></pre></div>
<p dir="auto">fails with,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="hi.rs:12:58: 12:69 error: unable to infer enough type information about `_`; type annotations required [E0282]
hi.rs:12             left: self.left.map(|x| { let a: Tree&lt;V&gt; = x.map_step(f);
                                                                  ^~~~~~~~~~~"><pre class="notranslate"><code class="notranslate">hi.rs:12:58: 12:69 error: unable to infer enough type information about `_`; type annotations required [E0282]
hi.rs:12             left: self.left.map(|x| { let a: Tree&lt;V&gt; = x.map_step(f);
                                                                  ^~~~~~~~~~~
</code></pre></div>
<p dir="auto">All of my attempts at helping the compiler find the right types have failed, therefore I suspect it's a bug.</p>
<p dir="auto">This code producesses an unclear error</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="pub trait ValueGiver&lt;T&gt; {
    fn give(_: Option&lt;Self&gt;) -&gt; T;
}

struct m;

impl&lt;f64&gt; ValueGiver&lt;f64&gt; for m {
    fn give(_:Option&lt;m&gt;) -&gt; f64 {
        0.5f64
    } 
}

fn main() {
    let y : f64 = ValueGiver::give(None::&lt;m&gt;);
}"><pre class="notranslate"><code class="notranslate">pub trait ValueGiver&lt;T&gt; {
    fn give(_: Option&lt;Self&gt;) -&gt; T;
}

struct m;

impl&lt;f64&gt; ValueGiver&lt;f64&gt; for m {
    fn give(_:Option&lt;m&gt;) -&gt; f64 {
        0.5f64
    } 
}

fn main() {
    let y : f64 = ValueGiver::give(None::&lt;m&gt;);
}
</code></pre></div>
<p dir="auto">Here the error of course is the <code class="notranslate">impl&lt;f64&gt;</code> that should be <code class="notranslate">impl</code>, but the error message is not clear :</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="c.rs:64:5: 68:6 error: unable to infer enough type information about `_`; type annotations required
c.rs:64     impl&lt;f64&gt; ValueGiver&lt;f64&gt; for m {
c.rs:65         fn give(_:Option&lt;m&gt;) -&gt; f64 {
c.rs:66             0.5f64
c.rs:67         } 
c.rs:68     }"><pre class="notranslate"><code class="notranslate">c.rs:64:5: 68:6 error: unable to infer enough type information about `_`; type annotations required
c.rs:64     impl&lt;f64&gt; ValueGiver&lt;f64&gt; for m {
c.rs:65         fn give(_:Option&lt;m&gt;) -&gt; f64 {
c.rs:66             0.5f64
c.rs:67         } 
c.rs:68     }
</code></pre></div>
<p dir="auto">Could this error message be more helpful ?</p>