Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swap MappedLocalTime and LocalResult type alias #1547

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

pitdicker
Copy link
Collaborator

In #1501 I thought renaming LocalResult to MappedLocalTime would be entirely without consequences as long as there is a type alias with the old name. Turns out there is one case where a type alias behaves differently 😞. You can't import enum variants from a type alias with use chrono::LocalResult::*.

We have two choices:

  • revert the rename entirely for the 0.4.x versions.
  • change the enum definition to be on LocalResult, and use the type alias everywhere else.

The second choice has my preference. The docs look mostly sane, but break down once you come to the trait implementations section:

afbeelding

...

afbeelding

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.82%. Comparing base (ca3c3b6) to head (19dd217).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1547   +/-   ##
=======================================
  Coverage   91.82%   91.82%           
=======================================
  Files          40       40           
  Lines       18345    18345           
=======================================
  Hits        16846    16846           
  Misses       1499     1499           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely annoying that importing the variants doesn't work correctly.

@pitdicker pitdicker merged commit 7d62045 into chronotope:main Mar 27, 2024
35 checks passed
@pitdicker pitdicker deleted the localresult_type_alias branch March 27, 2024 11:42
@pitdicker
Copy link
Collaborator Author

Published.

I'll look through the rust issue tracker if there is anything about type aliases for enums.

@pitdicker
Copy link
Collaborator Author

Opened rust-lang/rust#123131.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants