KokaKiwi / rust-hex

A basic crate to encode values to hexadecimal representation. Originally extracted from rustc-serialize.
https://crates.io/crates/hex
Apache License 2.0
203 stars 57 forks source link

0.4.3 was a breaking change #55

Open Nemo157 opened 3 years ago

Nemo157 commented 3 years ago
> cargo new foo && cd foo
     Created binary (application) `foo` package
> cargo add --vers 0.4.2 hex --no-default-features
    Updating 'https://github.com/rust-lang/crates.io-index' index
      Adding hex v0.4.2 to dependencies
> echo 'fn main() { dbg!(hex::encode(b"1234")); }' > src/main.rs
> cargo update --precise 0.4.2 -p hex
    Updating crates.io index
    Updating hex v0.4.3 -> v0.4.2
> cargo run
   Compiling hex v0.4.2
   Compiling foo v0.1.0 (/tmp/tmp.EwT6eRV1y2/foo)
    Finished dev [unoptimized + debuginfo] target(s) in 0.51s
     Running `/home/nemo157/.cargo/shared-target/debug/foo`
[src/main.rs:1] hex::encode(b"1234") = "31323334"
> cargo update -p hex
    Updating crates.io index
    Updating hex v0.4.2 -> v0.4.3
> cargo run
   Compiling foo v0.1.0 (/tmp/tmp.EwT6eRV1y2/foo)
error[E0425]: cannot find function `encode` in crate `hex`
 --> src/main.rs:1:23
  |
1 | fn main() { dbg!(hex::encode(b"1234")); }
  |                       ^^^^^^ not found in `hex`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
error: could not compile `foo`

To learn more, run the command again with --verbose.

Moving an existing API under a feature flag is a breaking change to all users with default-features = false specified.

eminence commented 3 years ago

Version 0.4.3 also changed the Minimum Supported Rust Version:

achin@bigbox:~/tmp/65/rust-hex$ git checkout v0.4.2
HEAD is now at be0c32f fix: Bump to v0.4.2

achin@bigbox:~/tmp/65/rust-hex$ cargo +1.34.0 check
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s
chin@bigbox:~/tmp/65/rust-hex$ git checkout v0.4.3
HEAD is now at b2b4370 Release v0.4.3

achin@bigbox:~/tmp/65/rust-hex$ cargo +1.34.0 check
    Updating crates.io index
    Checking hex v0.4.3 (/home/achin/tmp/65/rust-hex)
error[E0658]: use of unstable library feature 'alloc': this library is unlikely to be stabilized in its current form or name (see issue #27783)
  --> src/lib.rs:41:1
   |
41 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `hex`.

To learn more, run the command again with --verbose.
Nemo157 commented 3 years ago

hex has no published MSRV policy, so it changing in a patch version is fine.

Given the age of this release, I'm not sure there's any point in doing anything. I assume I'm the only one to be hit by the issue, and I'm just about to publish a patch release to my library that will support both 0.4.2 and 0.4.3. Just something to keep aware of for next time.

KokaKiwi commented 3 years ago

Yup really sorry about that, i'm still having issues dealing with API and versions compatibilities :disappointed: I'll write down this issue on my checklist for futures releases, so i wouldn't make the same mistake..

Also, i really want to work on finally making the hex-1.0 release and dealing with stuff like MSRV but due to personal issues it's kinda complicated right now so i'm working on it sporadically

I'll keep this issue open to keep it visible until the next release which will hopefully be better prepared ^^'

HeroicKatora commented 3 years ago

Speaking from experience both the inability to add new feature flags and MSRV is annoying. Maybe annoying to the point of warranting support in cargo. I'm not sure if this would be in the form of detection and warning on publish or in the form of a better dependency specification language that allows such changes to be made without breaking anyone downstream. We can provide both this, wgpu, and several image-related crates as examples.

ckcr4lyf commented 1 year ago

FYI: If you're like me and realize you need to use 0.4.2, you can force the downgrade by changing the dependency as such:

hex = "=0.4.2"

If you just do hex = "0.4.2" then cargo will keep using the 0.4.3 version.