I just uncovered a rather surprising "failure" of exhaustiveness
checking. There was an enum defined like so in a module A:
enum foo { a, b, c }
and then, in another module B:
import A::{foo, a, b}; // Note: no c!
fn bar(f: foo) {
alt f {
a {"a"}
b {"b"}
c {"c"}
}
}
Now this code worked fine, but there is a subtle bug: the value c here
is not acting as a variant but rather a catch-all. So now when I added
a new variant `d`, the code still compiled fine but just acted funny.
I recall this sort of hazard was pointed out earlier (though in that
case the example was of removing a variant, which can lead to a similar
sort of catch-all). Also, fixing bug #941 (warn about unused bindings
in patterns) would also have prevented this error. But still, nasty!
Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev