Closed
Description
When doing pattern matching on a C-like enum whose values haven't be imported in the current namespace, like :
mod foo {
enum Bar {
Baz,
Qux
}
}
// ...
match someBar {
Baz => // ...
Qux => // ...
}
Rustc doesn't know Baz and Qux are values, since they are not imported.
The first Baz pattern is thus considered as a binding, and all following patterns are seen as "unreachable".
Maybe we should put the enum value names inside the namespace of the enum type (like C++11 enum classes), and, in any case, implement a better error or warning message. Many people apparently ran into this issue, and found it very weird and hard to debug. (cc @cmr )
Metadata
Metadata
Assignees
Labels
No labels