Closed
Description
This code compiles on nightly:
enum Foo {
Bar(i32),
Baz
}
fn main() {
let x = Foo::Bar(1);
if let Foo::Bar = x {
println!("Hello");
}
}
Which it shouldn't, since Foo::Bar
variant has a field and the pattern doesn't mention it. This can also cause an ICE:
enum Foo {
Bar(i32),
Baz
}
fn main() {
match Foo::Bar(42) {
Foo::Bar(x) => {},
Foo::Bar => {},
_ => {}
}
}