<p dir="auto">The following code:</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="pub fn log(x: f64) -&gt; f64
{
    let out: f64;
    unsafe {
    asm!(&quot;fldln2
        fldl $1
        fyl2x&quot; : &quot;=t&quot;(out) : &quot;m&quot;(x));}
    out
}"><pre class="notranslate"><span class="pl-k">pub</span> <span class="pl-k">fn</span> <span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">x</span><span class="pl-kos">:</span> <span class="pl-smi">f64</span><span class="pl-kos">)</span> -&gt; <span class="pl-smi">f64</span>
<span class="pl-kos">{</span>
    <span class="pl-k">let</span> out<span class="pl-kos">:</span> <span class="pl-smi">f64</span><span class="pl-kos">;</span>
    <span class="pl-k">unsafe</span> <span class="pl-kos">{</span>
    <span class="pl-en">asm</span><span class="pl-en">!</span><span class="pl-kos">(</span><span class="pl-s">"fldln2</span>
<span class="pl-s">        fldl $1</span>
<span class="pl-s">        fyl2x"</span> : <span class="pl-s">"=t"</span><span class="pl-kos">(</span>out<span class="pl-kos">)</span> : <span class="pl-s">"m"</span><span class="pl-kos">(</span>x<span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">;</span><span class="pl-kos">}</span>
    out
<span class="pl-kos">}</span></pre></div>
<p dir="auto">errors with the message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: couldn't allocate output register for constraint 't' at line 27"><pre class="notranslate"><code class="notranslate">error: couldn't allocate output register for constraint 't' at line 27
</code></pre></div>
<p dir="auto">The constraint <code class="notranslate">t</code> refers to the top of the floating point stack in GCC's inline assembly, and the unsafe guide says our constraints mirror theirs.</p>
<p dir="auto">The <code class="notranslate">sum</code> and <code class="notranslate">product</code> methods are wrappers around <code class="notranslate">fold</code>, but only work with iterators where the element type <code class="notranslate">A</code> directly implements <code class="notranslate">Add&lt;A, A&gt;</code>/<code class="notranslate">Mul&lt;A, A&gt;</code>. With an iterator of references to numbers, you can do <code class="notranslate">iter().fold(0, |a, b| a + *b)</code>, but with <code class="notranslate">sum</code>/<code class="notranslate">product</code> the elements have to be cloned via <code class="notranslate">map</code> (inefficient for big integers, and uglier than using <code class="notranslate">fold</code>).</p>
<p dir="auto">The <code class="notranslate">to_owned_vec</code> method simply calls <code class="notranslate">collect</code>, and removes the need to specify a type annotation. It's the only method on iterators using a specific container type, which is ugly. A language solution to this problem (partial type hints? <code class="notranslate">collect::&lt;~[_]&gt;()</code>) would be nice.</p>
<p dir="auto">These are good candidates for being marked with a stability warning attribute.</p>