rustdoc: Correctly distinguish enums and types

This is done by adding a new field to the `DefTy` variant of `middle::def::Def`,
which also clarifies an error message in the process.

Closes #16712.