blob: 0ee8bf0c7c7dc90e7e5693cffa357e73a2385daa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
struct X {
x: ~str,
drop {
error!("value: %s", self.x);
}
}
fn unwrap(+x: X) -> ~str {
let X { x: y } = x; //~ ERROR deconstructing struct not allowed in pattern
y
}
fn main() {
let x = X { x: ~"hello" };
let y = unwrap(x);
error!("contents: %s", y);
}
|