2017-10-13 13:36:15 +00:00
|
|
|
enum Foo {
|
|
|
|
A(i32),
|
|
|
|
B
|
|
|
|
}
|
|
|
|
|
|
|
|
fn match_enum() {
|
|
|
|
let mut foo = Foo::B;
|
|
|
|
let p = &mut foo;
|
2021-07-23 22:55:36 +00:00
|
|
|
let _ = match foo { //~ ERROR [E0503]
|
|
|
|
Foo::B => 1,
|
2017-10-13 13:36:15 +00:00
|
|
|
_ => 2,
|
2019-04-22 07:40:08 +00:00
|
|
|
Foo::A(x) => x //~ ERROR [E0503]
|
2017-10-13 13:36:15 +00:00
|
|
|
};
|
2018-04-09 09:28:00 +00:00
|
|
|
drop(p);
|
2017-10-13 13:36:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-10-11 14:39:45 +00:00
|
|
|
fn main() {
|
|
|
|
let mut x = 1;
|
2018-04-09 09:28:00 +00:00
|
|
|
let r = &mut x;
|
2018-09-13 21:04:09 +00:00
|
|
|
let _ = match x {
|
2019-04-22 07:40:08 +00:00
|
|
|
x => x + 1, //~ ERROR [E0503]
|
|
|
|
y => y + 2, //~ ERROR [E0503]
|
2017-10-11 14:39:45 +00:00
|
|
|
};
|
2018-04-09 09:28:00 +00:00
|
|
|
drop(r);
|
2017-10-11 14:39:45 +00:00
|
|
|
}
|