tkaitchuck / aHash

aHash is a non-cryptographic hashing algorithm that uses the AES hardware instruction
https://crates.io/crates/ahash
Apache License 2.0
986 stars 94 forks source link

Require an opt-in for enabling `min_specialization` rustc feature #238

Open alexcrichton opened 3 weeks ago

alexcrichton commented 3 weeks ago

I'm in the process of adding a new tool to the Rust compiler but it's failing to build on CI. The root of the reason appears to be that this crate will automatically enable usage of the min_specialization feature on Nightly-looking Rust channels but the way that Rust is compiling crates makes it so the min_specialization feature isn't detected but this crate doesn't catch it. This is distinct from 76dd8d265d236b29f98645d158f4af3a90781143 in that -Zallow-features is used as part of the rustc build but it's used in a non-default way. Overall the end-state is that this crate is causing a build failure as a transitive dependency of the tool I'm adding.

Given that context I'd like to pose a question, how would you feel about making usage of min_specialization require an opt-in from users rather than implicitly enabling it on supporting Nightly channels? That would look like a crate feature, a required RUSTFLAGS entry, or perhaps an environment variable at build time.

In addition to the rationale of working as part of rust-lang/rust I'd also offer the rationale that Nightly Rust features can theoretically break at any time and users using a Nightly toolchain may not expect breakage from crates because unstable features change. Requiring an explicit opt-in would help with that since then only those opting-in would be broken which would be expected.

I'm happy to make a PR for this as well, but wanted to gauge interest in such a change before doing so to make sure I wouldn't step on any toes.