-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.fixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.

Description
The following code worked on 0.11
bu no longer works on master
. Last known good nightly was August 1st.
struct Foo {
a: Vec<u8>,
b: Vec<u8>
}
fn main() {
let foo = box Foo{a: Vec::new(), b: Vec::new()};
let Foo { a: a, b: b } = *foo;
}
This will create the following error message:
<anon>:8:24: 8:25 error: use of partially moved value: `foo.b`
<anon>:8 let Foo { a: a, b: b } = *foo;
^
<anon>:8:18: 8:19 note: `foo.a` moved here because it has type `collections::vec::Vec<u8>`, which is moved by default (use `ref` to override)
<anon>:8 let Foo { a: a, b: b } = *foo;
If Foo
is not boxed this will function correctly.
struct Foo {
a: Vec<u8>,
b: Vec<u8>
}
fn main() {
let foo = Foo{a: Vec::new(), b: Vec::new()};
let Foo { a: a, b: b } = foo;
}
frewsxcv, kirillkh, m-novikov, jonhoo, NickeZ and 6 more
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.fixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.