2018-12-17 03:21:47 +00:00
|
|
|
enum Opts {
|
2020-03-04 02:58:52 +00:00
|
|
|
A(isize),
|
|
|
|
B(isize),
|
|
|
|
C(isize),
|
2012-08-06 14:20:23 +00:00
|
|
|
}
|
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
fn matcher1(x: Opts) {
|
2012-08-06 23:16:08 +00:00
|
|
|
match x {
|
2020-03-04 02:58:52 +00:00
|
|
|
Opts::A(ref i) | Opts::B(i) => {}
|
|
|
|
//~^ ERROR variable `i` is bound inconsistently
|
|
|
|
//~^^ ERROR mismatched types
|
|
|
|
Opts::C(_) => {}
|
2012-08-06 14:20:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
fn matcher2(x: Opts) {
|
2012-08-06 23:16:08 +00:00
|
|
|
match x {
|
2020-03-04 02:58:52 +00:00
|
|
|
Opts::A(ref i) | Opts::B(i) => {}
|
|
|
|
//~^ ERROR variable `i` is bound inconsistently
|
|
|
|
//~^^ ERROR mismatched types
|
|
|
|
Opts::C(_) => {}
|
2012-08-06 14:20:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
fn matcher4(x: Opts) {
|
2012-08-06 23:16:08 +00:00
|
|
|
match x {
|
2020-03-04 02:58:52 +00:00
|
|
|
Opts::A(ref mut i) | Opts::B(ref i) => {}
|
|
|
|
//~^ ERROR variable `i` is bound inconsistently
|
|
|
|
//~^^ ERROR mismatched types
|
|
|
|
Opts::C(_) => {}
|
2012-08-06 14:20:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-17 03:21:47 +00:00
|
|
|
fn matcher5(x: Opts) {
|
2012-08-06 23:16:08 +00:00
|
|
|
match x {
|
2020-03-04 02:58:52 +00:00
|
|
|
Opts::A(ref i) | Opts::B(ref i) => {}
|
|
|
|
Opts::C(_) => {}
|
2012-08-06 14:20:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-06 23:16:08 +00:00
|
|
|
fn main() {}
|