Open
Description
In chrono 0.4.36 we renamed a LocalResult
enum to MappedLocalTime
, and added a type alias with the name LocalResult
.
This turned out to be a breaking change because enum variants can't be imported through a type alias.
enum MappedLocalTime {
Single,
Ambiguous,
None,
}
type LocalResult = MappedLocalTime;
use LocalResult::*;
Gives the error:
Checking alias v0.1.0 (C:\Users\dicke\Documents\alias)
error[E0432]: unresolved import `LocalResult`
--> src\main.rs:9:5
|
9 | use LocalResult::*; // fails
| ^^^^^^^^^^^ `LocalResult` is a type alias, not a module
For more information about this error, try `rustc --explain E0432`.
error: could not compile `alias` (bin "alias") due to previous error
I expected the type alias to behave identical to the enum.
Maybe related to RFC 2338 Type alias enum variants.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
MappedLocalTime
andLocalResult
type alias chronotope/chrono#1547djc commentedon Mar 27, 2024
As the author of that RFC, I would also have expected this, but of course the RFC doesn't specify explicitly. Tracking issue: #49683.
cuviper commentedon Mar 29, 2024
If the type alias sets generic parameters, should that carry through?