You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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<u8>`, 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
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).
Edit: I posted the wrong error message in the first version of this bug; fixed now.
The text was updated successfully, but these errors were encountered:
Removing the box by adding the line let child = *child before destructuring is a workaround.
apoelstra
changed the title
Moving out of structs by destructuring no longer works
Moving out of boxed structs by destructuring no longer works
Sep 20, 2015
In 1.3.0,
fails with
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).
Edit: I posted the wrong error message in the first version of this bug; fixed now.
The text was updated successfully, but these errors were encountered: