Namespaced enums

These changes bring us up to date with Rust's move to namespaced enums. We're also able to get rid of some duplication in enum names and modules.

The changes here are not backwards compatible.