<p dir="auto">In 1.3.0,</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="struct PatriciaTree {
    data: Box&lt;u8&gt;,
    child_l: Box&lt;u8&gt;,
}

impl PatriciaTree {
    fn delete(&amp;mut self) {
        let child = Box::new(PatriciaTree { data: Box::new(5), child_l: Box::new(5) });
        let PatriciaTree { data, child_l } = *child;
    }
}

fn main() {}"><pre class="notranslate"><code class="notranslate">struct PatriciaTree {
    data: Box&lt;u8&gt;,
    child_l: Box&lt;u8&gt;,
}

impl PatriciaTree {
    fn delete(&amp;mut self) {
        let child = Box::new(PatriciaTree { data: Box::new(5), child_l: Box::new(5) });
        let PatriciaTree { data, child_l } = *child;
    }
}

fn main() {}
</code></pre></div>
<p dir="auto">fails with</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="break3.rs:10:34: 10:41 error: use of moved value: `child` [E0382]
break3.rs:10         let PatriciaTree { data, child_l } = *child;
                                              ^~~~~~~
break3.rs:10:28: 10:32 note: `child` moved here (through moving `child.data`) because it has type `Box&lt;u8&gt;`, which is moved by default
break3.rs:10         let PatriciaTree { data, child_l } = *child;
                                        ^~~~
break3.rs:10:28: 10:32 help: if you would like to borrow the value instead, use a `ref` binding as shown:
break3.rs:           let PatriciaTree { ref data, child_l } = *child;
error: aborting due to previous error"><pre class="notranslate"><code class="notranslate">break3.rs:10:34: 10:41 error: use of moved value: `child` [E0382]
break3.rs:10         let PatriciaTree { data, child_l } = *child;
                                              ^~~~~~~
break3.rs:10:28: 10:32 note: `child` moved here (through moving `child.data`) because it has type `Box&lt;u8&gt;`, which is moved by default
break3.rs:10         let PatriciaTree { data, child_l } = *child;
                                        ^~~~
break3.rs:10:28: 10:32 help: if you would like to borrow the value instead, use a `ref` binding as shown:
break3.rs:           let PatriciaTree { ref data, child_l } = *child;
error: aborting due to previous error
</code></pre></div>
<p dir="auto">This is a common pattern for moving all the fields at once out of a struct (since moving them one by one could introduce memory unsafety).</p>
<p dir="auto"><strong>Edit:</strong> I posted the wrong error message in the first version of this bug; fixed now.</p>
<p dir="auto">The following code worked on <code class="notranslate">0.11</code> bu no longer works on <code class="notranslate">master</code>. Last known good nightly was August 1st.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct Foo {
    a: Vec&lt;u8&gt;,
    b: Vec&lt;u8&gt;
}

fn main() {
    let foo = box Foo{a: Vec::new(), b: Vec::new()};
    let Foo { a: a, b: b } = *foo;
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">a</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">u8</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span>
    <span class="pl-c1">b</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">u8</span><span class="pl-kos">&gt;</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> foo = box <span class="pl-smi">Foo</span><span class="pl-kos">{</span><span class="pl-c1">a</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-c1">b</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">::</span><span class="pl-en">new</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">let</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span><span class="pl-kos">:</span> a<span class="pl-kos">,</span> <span class="pl-c1">b</span><span class="pl-kos">:</span> b <span class="pl-kos">}</span> = <span class="pl-c1">*</span>foo<span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">This will create the following error message:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;anon&gt;:8:24: 8:25 error: use of partially moved value: `foo.b`
&lt;anon&gt;:8     let Foo { a: a, b: b } = *foo;
                                ^
&lt;anon&gt;:8:18: 8:19 note: `foo.a` moved here because it has type `collections::vec::Vec&lt;u8&gt;`, which is moved by default (use `ref` to override)
&lt;anon&gt;:8     let Foo { a: a, b: b } = *foo;"><pre class="notranslate"><code class="notranslate">&lt;anon&gt;:8:24: 8:25 error: use of partially moved value: `foo.b`
&lt;anon&gt;:8     let Foo { a: a, b: b } = *foo;
                                ^
&lt;anon&gt;:8:18: 8:19 note: `foo.a` moved here because it has type `collections::vec::Vec&lt;u8&gt;`, which is moved by default (use `ref` to override)
&lt;anon&gt;:8     let Foo { a: a, b: b } = *foo;
</code></pre></div>
<p dir="auto">If <code class="notranslate">Foo</code> is not boxed this will function correctly.</p>
<div class="highlight highlight-source-rust notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="struct Foo {
    a: Vec&lt;u8&gt;,
    b: Vec&lt;u8&gt;
}

fn main() {
    let foo = Foo{a: Vec::new(), b: Vec::new()};
    let Foo { a: a, b: b } = foo;
}"><pre class="notranslate"><span class="pl-k">struct</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span>
    <span class="pl-c1">a</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">u8</span><span class="pl-kos">&gt;</span><span class="pl-kos">,</span>
    <span class="pl-c1">b</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">&lt;</span><span class="pl-smi">u8</span><span class="pl-kos">&gt;</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> foo = <span class="pl-smi">Foo</span><span class="pl-kos">{</span><span class="pl-c1">a</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">::</span><span class="pl-en">new</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">,</span> <span class="pl-c1">b</span><span class="pl-kos">:</span> <span class="pl-smi">Vec</span><span class="pl-kos">::</span><span class="pl-en">new</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">let</span> <span class="pl-smi">Foo</span> <span class="pl-kos">{</span> <span class="pl-c1">a</span><span class="pl-kos">:</span> a<span class="pl-kos">,</span> <span class="pl-c1">b</span><span class="pl-kos">:</span> b <span class="pl-kos">}</span> = foo<span class="pl-kos">;</span>
<span class="pl-kos">}</span></pre></div>