-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team
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) .
ggutoski, joseluis and nyurik
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.T-langRelevant to the language teamRelevant to the language team