blob: 95091f15ce0e57afbf465ec69656b736f34b9b89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
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 => {}
&Bar(identifier) => f(copy identifier) //~ ERROR by-move pattern bindings may not occur
};
match &s.x {
&Foo => {}
&Bar(ref identifier) => io::println(*identifier)
};
}
|