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

Issues with hashbrown 0.4 -> 0.5 upgrade #279

Closed
tarcieri opened this issue Jul 15, 2019 · 3 comments · Fixed by #280
Closed

Issues with hashbrown 0.4 -> 0.5 upgrade #279

tarcieri opened this issue Jul 15, 2019 · 3 comments · Fixed by #280
Assignees
Labels
Milestone

Comments

@tarcieri
Copy link

hashbrown::HashMap is part of the public API of this crate in several places, e.g.:

https://docs.rs/handlebars/2.0.1/handlebars/struct.Handlebars.html#method.get_templates

Between Handlebars 2.0.0 and 2.0.1, hashbrown was updated from 0.4 to 0.5. This broke installation of my crate (cargo install abscissa), since it was using hashbrown v0.4.

Some options I can think of:

  • Re-export either hashbrown (e.g. pub use hashbrown in the crate root) or hashbrown::HashMap so I don't have to depend on the hashbrown crate
  • Wrap hashbrown::HashMap in a newtype
  • Switch to std::collections::HashMap as std is switching to hashbrown anyway
tarcieri pushed a commit to iqlusioninc/abscissa that referenced this issue Jul 15, 2019
handlebars 2.0.0 -> 2.0.1 upgraded `hashbrown` versions from 0.4 to 0.5
and in doing so broke the Abscissa v0.1 release, which now has an older
incompatible v0.4. I've opened an upstream issue about this here:

sunng87/handlebars-rust#279

To avoid this in the future, this change removes the external
dependency. The implementation is a bit hacky, but gets the job done.
@sunng87
Copy link
Owner

sunng87 commented Jul 16, 2019

I see. That was a common issue in rust ecosystem. To be practical I will be reexport those types used in public APIs, that was your 1 solution.

And I will be releasing the change in a patch version, do you think it works for you?

@tarcieri
Copy link
Author

@sunng87 I think the best option is probably to switch back to std::collections::HashMap since std will be incorporating it anyway.

That said, whatever works: I'd be happy for a 2.0.2 that re-exports the hashbrown type as a solution too

@sunng87
Copy link
Owner

sunng87 commented Jul 16, 2019

That was annoying because either reexporting or switching to std HashMap is actually a breaking change, that requires a major version bump if we are strict on semver. I have to prevent it from breaking more applications if they depend on that API.

I will benchmark performance between current hashbrown and the one in std to decide if I will switch in future.

@sunng87 sunng87 self-assigned this Jul 16, 2019
@sunng87 sunng87 added the bug label Jul 16, 2019
@sunng87 sunng87 added this to the 3.0 milestone Jul 16, 2019
sunng87 added a commit that referenced this issue Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants