Skip to content

Commit dba28d4

Browse files
committed
Remove build-time check for stdsimd feature
This is blocking rust-lang/rust#117372, which replaces `stdsimd` with more fine-grained features. However the auto-detection in aHash breaks when bootstrapping Rust because it detects the `stdsimd` feature on the old toolchain which is not present on the newly build libcore. This PR removes the build-time detection of the `stdsimd` feature and instead just uses the ARM AES intrinsics directly since they are now stable, but only on AArch64.
1 parent 7fbcf0f commit dba28d4

File tree

6 files changed

+7
-35
lines changed

6 files changed

+7
-35
lines changed

build.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ fn main() {
77
if let Some(true) = version_check::supports_feature("specialize") {
88
println!("cargo:rustc-cfg=feature=\"specialize\"");
99
}
10-
if let Some(true) = version_check::supports_feature("stdsimd") {
11-
println!("cargo:rustc-cfg=feature=\"stdsimd\"");
12-
}
1310
let arch = env::var("CARGO_CFG_TARGET_ARCH").expect("CARGO_CFG_TARGET_ARCH was not set");
1411
if arch.eq_ignore_ascii_case("x86_64")
1512
|| arch.eq_ignore_ascii_case("aarch64")

src/hash_quality_test.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,7 @@ mod fallback_tests {
437437
///Basic sanity tests of the cypto properties of aHash.
438438
#[cfg(any(
439439
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
440-
all(
441-
any(target_arch = "arm", target_arch = "aarch64"),
442-
any(target_feature = "aes", target_feature = "crypto"),
443-
not(miri),
444-
feature = "stdsimd"
445-
)
440+
all(target_arch = "aarch64", target_feature = "aes", not(miri)),
446441
))]
447442
#[cfg(test)]
448443
mod aes_tests {

src/lib.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ Note the import of [HashMapExt]. This is needed for the constructor.
9595
#![allow(clippy::pedantic, clippy::cast_lossless, clippy::unreadable_literal)]
9696
#![cfg_attr(all(not(test), not(feature = "std")), no_std)]
9797
#![cfg_attr(feature = "specialize", feature(min_specialization))]
98-
#![cfg_attr(feature = "specialize", feature(build_hasher_simple_hash_one))]
99-
#![cfg_attr(feature = "stdsimd", feature(stdsimd))]
10098

10199
#[macro_use]
102100
mod convert;
@@ -106,11 +104,8 @@ mod fallback_hash;
106104
cfg_if::cfg_if! {
107105
if #[cfg(any(
108106
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
109-
all(any(target_arch = "arm", target_arch = "aarch64"),
110-
any(target_feature = "aes", target_feature = "crypto"),
111-
not(miri),
112-
feature = "stdsimd")
113-
))] {
107+
all(target_arch = "aarch64", target_feature = "aes", not(miri)),
108+
))] {
114109
mod aes_hash;
115110
pub use crate::aes_hash::AHasher;
116111
} else {

src/operations.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,7 @@ pub(crate) fn aesenc(value: u128, xor: u128) -> u128 {
110110
}
111111
}
112112

113-
#[cfg(all(
114-
any(target_arch = "arm", target_arch = "aarch64"),
115-
any(target_feature = "aes", target_feature = "crypto"),
116-
not(miri),
117-
feature = "stdsimd"
118-
))]
113+
#[cfg(all(target_arch = "aarch64", target_feature = "aes", not(miri)))]
119114
#[allow(unused)]
120115
#[inline(always)]
121116
pub(crate) fn aesenc(value: u128, xor: u128) -> u128 {
@@ -142,12 +137,7 @@ pub(crate) fn aesdec(value: u128, xor: u128) -> u128 {
142137
}
143138
}
144139

145-
#[cfg(all(
146-
any(target_arch = "arm", target_arch = "aarch64"),
147-
any(target_feature = "aes", target_feature = "crypto"),
148-
not(miri),
149-
feature = "stdsimd"
150-
))]
140+
#[cfg(all(target_arch = "aarch64", target_feature = "aes", not(miri)))]
151141
#[allow(unused)]
152142
#[inline(always)]
153143
pub(crate) fn aesdec(value: u128, xor: u128) -> u128 {

src/random_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use core::hash::Hash;
22
cfg_if::cfg_if! {
33
if #[cfg(any(
44
all(any(target_arch = "x86", target_arch = "x86_64"), target_feature = "aes", not(miri)),
5-
all(any(target_arch = "arm", target_arch = "aarch64"), any(target_feature = "aes", target_feature = "crypto"), not(miri), feature = "stdsimd")
5+
all(target_arch = "aarch64", target_feature = "aes", not(miri)),
66
))] {
77
use crate::aes_hash::*;
88
} else {

tests/bench.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ const AHASH_IMPL: &str = if cfg!(any(
1414
target_feature = "aes",
1515
not(miri),
1616
),
17-
all(
18-
any(target_arch = "arm", target_arch = "aarch64"),
19-
any(target_feature = "aes", target_feature = "crypto"),
20-
not(miri),
21-
feature = "stdsimd",
22-
),
17+
all(target_arch = "aarch64", target_feature = "aes", not(miri)),
2318
)) {
2419
"aeshash"
2520
} else {

0 commit comments

Comments
 (0)