2012-12-14 17:50:48 -08:00
|
|
|
enum E {
|
|
|
|
Foo,
|
|
|
|
Bar(~str)
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S {
|
|
|
|
x: E
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f(x: ~str) {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let s = S { x: Bar(~"hello") };
|
|
|
|
match &s.x {
|
|
|
|
&Foo => {}
|
2013-07-02 12:47:32 -07:00
|
|
|
&Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
|
2012-12-14 17:50:48 -08:00
|
|
|
};
|
|
|
|
match &s.x {
|
|
|
|
&Foo => {}
|
2014-01-09 21:06:55 +11:00
|
|
|
&Bar(ref identifier) => println!("{}", *identifier)
|
2012-12-14 17:50:48 -08:00
|
|
|
};
|
|
|
|
}
|