rust/src/test/compile-fail/match-struct.rs
Seo Sanghyeon a29023e9b2 Check type when struct is matched against enum-like pattern
Previously check always succeeded because struct type was derived from
the matched expression, not the matched pattern.
2013-02-20 02:44:02 +09:00

12 lines
154 B
Rust

// error-pattern: mismatched types
struct S { a: int }
enum E { C(int) }
fn main() {
match S { a: 1 } {
C(_) => (),
_ => ()
}
}