Add special case for UnitVariant(..) patterns

This commit is contained in:
Vadim Petrochenkov 2015-11-16 17:26:14 +03:00
parent 35749923ee
commit 4573bb8e96
4 changed files with 20 additions and 13 deletions

View file

@ -34,6 +34,6 @@ fn main() {
// E::Empty2() => () // ERROR `E::Empty2` does not name a tuple variant or a tuple struct
// }
match e2 {
E::Empty2(..) => () //~ ERROR `E::Empty2` does not name a tuple variant or a tuple struct
E::Empty2(..) => () //~ WARN `E::Empty2` does not name a tuple variant or a tuple struct
}
}

View file

@ -20,7 +20,8 @@ fn main() {
color::rgb(_, _, _) => { }
color::cmyk(_, _, _, _) => { }
color::no_color(_) => { }
//~^ ERROR `color::no_color` does not name a tuple variant or a tuple struct
//~^ ERROR this pattern has 1 field, but the corresponding variant has no fields
//~^^ WARN `color::no_color` does not name a tuple variant or a tuple struct
}
}
}

View file

@ -25,7 +25,8 @@ fn f(_c: char) {}
fn main() {
match A::B(1, 2) {
A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but
A::D(_) => (), //~ ERROR `A::D` does not name a tuple variant or a tuple struct
A::D(_) => (), //~ ERROR this pattern has 1 field, but
//~^ WARN `A::D` does not name a tuple variant or a tuple struct
_ => ()
}
match 'c' {