<p dir="auto">It seems like this was broken as a result of the recent change to make newtypes structs immediate in certain cases.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct TestNode(@int);

fn mm(_x: &amp;TestNode) {}

fn main() {
    let x = &amp;TestNode(@21);
    mm(x);
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">TestNode</span><span class="pl-kos">(</span>@<span class="pl-smi">int</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

<span class="pl-k">fn</span> <span class="pl-en">mm</span><span class="pl-kos">(</span><span class="pl-s1">_x</span><span class="pl-kos">:</span> <span class="pl-c1">&amp;</span><span class="pl-smi">TestNode</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-k">let</span> x = <span class="pl-c1">&amp;</span><span class="pl-v">TestNode</span><span class="pl-kos">(</span>@<span class="pl-c1">21</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
    <span class="pl-en">mm</span><span class="pl-kos">(</span>x<span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="% rustc foo.rs
error: internal compiler error: drop_ty_immediate: non-box ty"><pre class="notranslate"><code class="notranslate">% rustc foo.rs
error: internal compiler error: drop_ty_immediate: non-box ty
</code></pre></div>
<p dir="auto">Minimal test case:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct Wrapper(~str);

impl Wrapper {
    pub fn new() -&gt; Wrapper {
        Wrapper(~&quot;Bob&quot;)
    }

    pub fn say_hi(&amp;self) {
        println(fmt!(&quot;hello %s&quot;, **self));
    }
}

impl Drop for Wrapper {
    fn drop(&amp;mut self) {}
}

fn main() {
    {
        // This runs without complaint.
        let x = Wrapper::new();
        x.say_hi();
    }
    {
        // This fails to compile.
        // error: internal compiler error: drop_ty_immediate: non-box ty
        Wrapper::new().say_hi();
    }
}"><pre class="notranslate"><code class="notranslate">struct Wrapper(~str);

impl Wrapper {
    pub fn new() -&gt; Wrapper {
        Wrapper(~"Bob")
    }

    pub fn say_hi(&amp;self) {
        println(fmt!("hello %s", **self));
    }
}

impl Drop for Wrapper {
    fn drop(&amp;mut self) {}
}

fn main() {
    {
        // This runs without complaint.
        let x = Wrapper::new();
        x.say_hi();
    }
    {
        // This fails to compile.
        // error: internal compiler error: drop_ty_immediate: non-box ty
        Wrapper::new().say_hi();
    }
}
</code></pre></div>
<p dir="auto">I originally ran accross this when wrapping a <code class="notranslate">*T</code>, but it also fails when I try to wrap <code class="notranslate">int</code> and other numeric types, <code class="notranslate">bool</code>, <code class="notranslate">Option&lt;T&gt;</code>, <code class="notranslate">~T</code>, and other structs that also wrap a single value of those types.</p>