Open
Description
RFC 2338 made it possible to access enum variants through type aliases, like so:
enum Foo { F1, F2 }
type Bar = Foo;
let x = Bar::F1;
However, the following code still fails to compile:
enum Foo { F1, F2 }
type Bar = Foo;
use Bar::F1;
with:
error[E0432]: unresolved import `Bar`
--> src/main.rs:6:5
|
6 | use Bar::F1;
| ^^^ `Bar` is a type alias, not a module
Type aliases being limited in this way is a problem for libstd because it means that deprecating/renaming any enum must inevitably involve a breaking change, since re-exporting cannot be used (#30827). This was encountered in #82122 (review) .