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

Fix build if compile-time-rng is disabled. #25

Merged

Conversation

0ndorio
Copy link
Contributor

@0ndorio 0ndorio commented Oct 29, 2019

The previous version always tried to include the const_random crate
even if the related feature was disabled. As this crates subscribed
into the 2018 edition the call should be obsolete and got deleted.

The previous version always tried to include the `const_random` crate
even if the related feature was disabled. As this crates subscribed
into the 2018 edition the call should be obsolete and got deleted.
bors added a commit to rust-lang/hashbrown that referenced this pull request Oct 31, 2019
Introduce `ahash-compile-time-rng` feature.

**Content**

Disables the default features of `ahash` and reintroduces them
through a new feature called `ahash-compile-time-rng`, which is
enabled by default.

The new feature makes it possible for depended crates to rely on
`hashbrown` with `ahash` as default hasher and to disable the
`compile-time-rng` at the same time.

This might be useful for any depended crate targeting `no_std`,
which contains `rand` or `rand_core` somewhere inside the dependency
tree as a bug in cargo accidentally enables the underlying `getrandom`
feature if `compile-time-rng` is enabled [1].

... fixes #124

[1] rust-lang/cargo#5760

---

**Warnings**

 (1) Compiling `ahash` with disabled `compile-time-rng` feature is currently broken and requires tkaitchuck/aHash#25 to be merged in advance.

 (2) This introduces a hidden behavior change for all dependent crates, using hashbrown with `default-features = false` and `features = 'ahash'`. This happens as the `ahash` feature no longer implicitly enables the `compile-time-rng` feature of `ahash`.

---

Is the naming of the feature okay?  Do I need to add any additional  changes?
@tkaitchuck
Copy link
Owner

I am confused by this diff, it's removing extern crate const_random; but it's leaving the annotation. I assume you want to remove the #![cfg_attr(all(not(test), ... too.

@eddyb
Copy link

eddyb commented Nov 8, 2019

@tkaitchuck The attribute is not for the extern crate, as it has the ! in it.

The lack of an empty line between the attribute and the extern crate appears accidental.

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

Successfully merging this pull request may close these issues.

None yet

3 participants