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

rustc-hash feature is non-additive. #43

Open
aDotInTheVoid opened this issue Oct 20, 2024 · 0 comments
Open

rustc-hash feature is non-additive. #43

aDotInTheVoid opened this issue Oct 20, 2024 · 0 comments

Comments

@aDotInTheVoid
Copy link
Member

cargo features are supposed to be additive, but rustc-hash isn't.

Consider the case where:

  1. Crate a depends on rustdoc-types with default features
    • Crate a relies on the HashMap using the default hasher.
  2. Crate b depends on rustdoc-types with rustc-hash feature.
  3. Crate c depends on a and b
  • Cargo does feature unification, and builds a agains rustdoc-types with rustc-hash enabled.
  • a fails to compile.

Potential fixes

  1. Ignore this, and hope it doesn't effect anyone
  2. Implement our own BuildHasher type that doesn't expose the underlying hashing algo, so changing it is additive
  3. Drop the rustc-hash feature, and always use it.
    3.1. Drop the rustc-hash feature, and never use it.
  4. Make Crate generic over the hasher type.

I think it's fine to go with 1 for now, but I'm filling this issue so I don't forget this.

Originally reported by @Noratrieb on fediverse

Caused by #42

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

No branches or pull requests

1 participant