Closed
Description
I observe the following behavior at 575710f
I expect the below program to fail to typecheck. It succeeds, however, and prints bogus output.
pub enum T {
T1(()),
T2(())
}
pub enum V {
V1(int),
V2(bool)
}
fn foo (x : (T, V)) {
match x {
(T1(()), V1(i)) => println!("T1(()), V1({})", i),
(T2(()), V2(b)) => println!("T2(()), V2({})", b),
// _ => ()
// We need to handle the T1,V2 and T2,V1 cases, but if we add
// the wildcard here, we get an "unreachable pattern" error.
}
}
fn main () {
foo((T1(()), V2(true)));
// prints "T1(()), V1(0)"
foo((T2(()), V1(99)));
// prints "T2(()), V2(false)"
}
This is perhaps related to recent changes by @jakub- ?
Metadata
Metadata
Assignees
Labels
No labels