2012-08-20 20:05:00 -04:00
|
|
|
struct X {
|
2012-09-07 14:50:47 -07:00
|
|
|
x: ~str,
|
2012-08-20 20:05:00 -04:00
|
|
|
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);
|
|
|
|
}
|