Skip to content

Commit 707db98

Browse files
committed
Fix aarch64 stable build
1 parent 669e4a2 commit 707db98

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pyo3 = { version = "^0.14.2", default_features = false, features = ["extension-m
7373
ryu = { version = "1", default_features = false }
7474
serde = { version = "1", default_features = false }
7575
serde_json = { version = "^1.0.66", default_features = false, features = ["std", "float_roundtrip"] }
76-
simdutf8 = { version = "0.1", default_features = false, optional = true }
76+
simdutf8 = { version = "0.1", default_features = false, features = ["std"] }
7777
smallvec = { version = "^1.6", default_features = false, features = ["union", "write"] }
7878

7979
[profile.release]

src/deserialize/deserializer.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::fmt;
1313
use std::os::raw::c_char;
1414
use std::ptr::NonNull;
1515

16-
#[cfg(all(target_arch = "x86_64", feature = "unstable-simd"))]
16+
#[cfg(target_arch = "x86_64")]
1717
fn is_valid_utf8(buf: &[u8]) -> bool {
1818
if std::is_x86_feature_detected!("sse4.2") {
1919
simdutf8::basic::from_utf8(buf).is_ok()
@@ -22,19 +22,19 @@ fn is_valid_utf8(buf: &[u8]) -> bool {
2222
}
2323
}
2424

25-
#[cfg(all(target_arch = "x86_64", not(feature = "unstable-simd")))]
25+
#[cfg(all(target_arch = "aarch64", feature = "unstable-simd"))]
2626
fn is_valid_utf8(buf: &[u8]) -> bool {
27-
encoding_rs::Encoding::utf8_valid_up_to(buf) == buf.len()
27+
simdutf8::basic::from_utf8(buf).is_ok()
2828
}
2929

30-
#[cfg(target_arch = "aarch64")]
30+
#[cfg(all(target_arch = "aarch64", not(feature = "unstable-simd")))]
3131
fn is_valid_utf8(buf: &[u8]) -> bool {
32-
simdutf8::basic::from_utf8(buf).is_ok()
32+
std::str::from_utf8(buf).is_ok()
3333
}
3434

3535
#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
3636
fn is_valid_utf8(buf: &[u8]) -> bool {
37-
simdutf8::basic::from_utf8(buf).is_ok()
37+
std::str::from_utf8(buf).is_ok()
3838
}
3939

4040
pub fn deserialize(

0 commit comments

Comments
 (0)