Fixes #13507

Fixes hashing of DefId for ty_enum.

Adds tests for cross-crate TypeId equivalence for various types.
auto merge of #13511 : Meyermagic/rust/enum_typeid, r=alexcrichton

Fixes #13507.

I haven't familiarized myself with this part of the rust compiler, so hopefully there are no mistakes (despite the simplicity of the commit). It is also 5am.