]> git.lizzy.rs Git - rust.git/blob - src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs
normalize stderr
[rust.git] / src / test / ui / disallowed-deconstructing / disallowed-deconstructing-destructing-struct-let.rs
1 struct X {
2     x: String,
3 }
4
5 impl Drop for X {
6     fn drop(&mut self) {
7         println!("value: {}", self.x);
8     }
9 }
10
11 fn unwrap(x: X) -> String {
12     let X { x: y } = x; //~ ERROR cannot move out of type
13     y
14 }
15
16 fn main() {
17     let x = X { x: "hello".to_string() };
18     let y = unwrap(x);
19     println!("contents: {}", y);
20 }