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

Renaming of FormatItem is a breaking change #675

Closed
arkeet opened this issue Apr 10, 2024 · 5 comments
Closed

Renaming of FormatItem is a breaking change #675

arkeet opened this issue Apr 10, 2024 · 5 comments
Labels
C-bug Category: bug in current code

Comments

@arkeet
Copy link

arkeet commented Apr 10, 2024

I noticed sqlx-sqlite (0.7.4) does not build with 0.3.35 (but built with 0.3.34):

error[E0432]: unresolved import `time::format_description::FormatItem`
   --> .../sqlx-sqlite-0.7.4/src/types/time.rs:192:72
    |
192 |     use time::format_description::{modifier, Component::*, FormatItem, FormatItem::*};
    |                                                                        ^^^^^^^^^^ `FormatItem` is a type alias, not a module

So evidently replacing an enum with a type alias is a breaking change. One possible fix is to replace the type alias with a re-export i.e. pub use BorrowedFormatItem as FormatItem;, but unfortunately deprecating re-exports doesn't work: rust-lang/rust#30827

@obi1kenobi
Copy link

A few folks have asked me directly, so for posterity: cargo-semver-checks would not have caught this today.

This is a breaking but not semver-major change, so it should be a "warn" or opt-in lint. cargo-semver-checks doesn't currently have such a capability, but it's something we're planning to add in the immediate future. After that, cargo-semver-checks will catch it and many more similar hazards (see "opt-in warnings" sections here).

@obi1kenobi
Copy link

Tangentially, if the maintainers of this repo might be interested in adopting cargo-semver-checks, I'd be happy to open a PR for it.

@jhpratt
Copy link
Member

jhpratt commented Apr 10, 2024

If I pub use the item rather than pub type, that would solve this? Ignoring the fact that use items cannot be deprecated.

@jhpratt jhpratt added the C-bug Category: bug in current code label Apr 11, 2024
@jhpratt
Copy link
Member

jhpratt commented Apr 11, 2024

This has been fixed and released. FormatItem is now re-exported via pub use, with pub type remaining in place for documentation purposes (namely showing the deprecation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug in current code
Projects
None yet
Development

No branches or pull requests

3 participants