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

Breaking change after png moved to codecs module #1365

Closed
okaneco opened this issue Nov 16, 2020 · 2 comments · Fixed by #1368
Closed

Breaking change after png moved to codecs module #1365

okaneco opened this issue Nov 16, 2020 · 2 comments · Fixed by #1368

Comments

@okaneco
Copy link
Contributor

okaneco commented Nov 16, 2020

I received an issue that my crate fails to build when installing with cargo from crates.io.
okaneco/kmeans-colors#35

I believe this was caused by #1328 which relocated png to the codecs module. This was a breaking change that prevents my crate from being compiled and installed. I have the image version in the Cargo.toml at "0.23", the image version in Cargo.lock is at "0.23.6". The change seems too large and non-backwards compatible to be included as a semver compatible minor or patch version. I had no idea it was broken until today.

Expected

The crate should install successfully.

Actual behaviour

The crate fails to compile and install.

   Compiling kmeans_colors v0.3.3
error[E0433]: failed to resolve: could not find `CompressionType` in `png`
  --> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\kmeans_colors-0.3.3\src\bin\kmeans_colors\utils.rs:89:25
   |
89 |             image::png::CompressionType::Best,
   |                         ^^^^^^^^^^^^^^^ could not find `CompressionType` in `png`

error[E0433]: failed to resolve: could not find `FilterType` in `png`
  --> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\kmeans_colors-0.3.3\src\bin\kmeans_colors\utils.rs:90:25
   |
90 |             image::png::FilterType::NoFilter,
   |                         ^^^^^^^^^^ could not find `FilterType` in `png`

error[E0433]: failed to resolve: could not find `CompressionType` in `png`
   --> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\kmeans_colors-0.3.3\src\bin\kmeans_colors\utils.rs:127:25
    |
127 |             image::png::CompressionType::Best,
    |                         ^^^^^^^^^^^^^^^ could not find `CompressionType` in `png`

error[E0433]: failed to resolve: could not find `FilterType` in `png`
   --> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\kmeans_colors-0.3.3\src\bin\kmeans_colors\utils.rs:128:25
    |
128 |             image::png::FilterType::NoFilter,
    |                         ^^^^^^^^^^ could not find `FilterType` in `png`

error: aborting due to 4 previous errors

Reproduction steps

Try to install kmeans_colors using cargo.

cargo install kmeans_colors

The repository
https://github.com/okaneco/kmeans-colors

The lines of code are located here
https://github.com/okaneco/kmeans-colors/blob/e8543480c3173154b7bd4eab7ce22e89d8ae4570/src/bin/kmeans_colors/utils.rs#L89-L90
https://github.com/okaneco/kmeans-colors/blob/e8543480c3173154b7bd4eab7ce22e89d8ae4570/src/bin/kmeans_colors/utils.rs#L127-L128

I can fix the issue by changing the fully qualified path.

image::codecs::png::CompressionType::Best,
image::codecs::png::FilterType::NoFilter,
//...
image::codecs::png::CompressionType::Best,
image::codecs::png::FilterType::NoFilter,
@okaneco
Copy link
Contributor Author

okaneco commented Nov 16, 2020

This broke identical code in another of my crates. https://github.com/okaneco/rscolorq
https://github.com/okaneco/rscolorq/blob/ce4205323ecbd45c3056678352780596cb497dc5/src/bin/rscolorq/utils.rs#L76-L77

The Cargo.lock has image version = "0.23.10".

Expected

The crate should install successfully.

Actual behaviour

The crate fails to compile and install.

error[E0433]: failed to resolve: could not find `CompressionType` in `png`
  --> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\rscolorq-0.1.0\src\bin\rscolorq\utils.rs:76:21
   |
76 |         image::png::CompressionType::Best,
   |                     ^^^^^^^^^^^^^^^ could not find `CompressionType` in `png`

error[E0433]: failed to resolve: could not find `FilterType` in `png`
  --> C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\rscolorq-0.1.0\src\bin\rscolorq\utils.rs:77:21
   |
77 |         image::png::FilterType::NoFilter,
   |                     ^^^^^^^^^^ could not find `FilterType` in `png`

error: aborting due to 2 previous errors

Reproduction steps

Try to install rscolorq using cargo.

cargo install rscolorq

@HeroicKatora
Copy link
Member

Sorry, you're right. The change had missed to re-exports: png::{CompressionType, FilterType}. Guess we'll best yank the version once the correction is published.

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

Successfully merging a pull request may close this issue.

2 participants