From ea27e5cfcb0bf156e11d45fd439ccbf539cd1d18 Mon Sep 17 00:00:00 2001 From: Amanieu d'Antras Date: Fri, 27 Oct 2023 13:37:04 +0100 Subject: [PATCH] Fix various compilation errors --- .../stdarch/crates/core_arch/src/arm/mod.rs | 2 ++ library/stdarch/crates/core_arch/src/lib.rs | 1 + .../stdarch/crates/intrinsic-test/src/main.rs | 8 +++++ library/stdarch/crates/std_detect/src/lib.rs | 2 ++ .../crates/std_detect/tests/cpu-detection.rs | 29 ++++++++++--------- .../std_detect/tests/macro_trailing_commas.rs | 4 ++- .../crates/stdarch-verify/tests/arm.rs | 3 +- library/stdarch/examples/connect5.rs | 4 ++- 8 files changed, 36 insertions(+), 17 deletions(-) diff --git a/library/stdarch/crates/core_arch/src/arm/mod.rs b/library/stdarch/crates/core_arch/src/arm/mod.rs index d994508e8174..217906c78da3 100644 --- a/library/stdarch/crates/core_arch/src/arm/mod.rs +++ b/library/stdarch/crates/core_arch/src/arm/mod.rs @@ -11,6 +11,8 @@ mod sat; #[cfg(any(target_feature = "v6", doc))] +// Remove warning because this module is currently empty. +#[allow(unused_imports)] pub use self::sat::*; // Supported arches: 5TE, 7E-M. See Section 10.1 of ACLE (e.g. QADD) diff --git a/library/stdarch/crates/core_arch/src/lib.rs b/library/stdarch/crates/core_arch/src/lib.rs index 155363b892d7..ed301e208a34 100644 --- a/library/stdarch/crates/core_arch/src/lib.rs +++ b/library/stdarch/crates/core_arch/src/lib.rs @@ -74,6 +74,7 @@ mod core_arch; #[stable(feature = "stdsimd", since = "1.27.0")] pub mod arch { #[stable(feature = "stdsimd", since = "1.27.0")] + #[allow(unused_imports)] pub use crate::core_arch::arch::*; #[stable(feature = "stdsimd", since = "1.27.0")] pub use core::arch::asm; diff --git a/library/stdarch/crates/intrinsic-test/src/main.rs b/library/stdarch/crates/intrinsic-test/src/main.rs index 162d3a72bd37..3c181584beff 100644 --- a/library/stdarch/crates/intrinsic-test/src/main.rs +++ b/library/stdarch/crates/intrinsic-test/src/main.rs @@ -166,6 +166,14 @@ fn generate_rust_program(notices: &str, intrinsic: &Intrinsic, a32: bool) -> Str format!( r#"{notices}#![feature(simd_ffi)] #![feature(link_llvm_intrinsics)] +#![cfg_attr(target_arch = "arm", feature(stdarch_arm_neon_intrinsics))] +#![feature(stdarch_arm_crc32)] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_fcma))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_dotprod))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_i8mm))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_sha3))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_sm4))] +#![cfg_attr(target_arch = "aarch64", feature(stdarch_neon_ftts))] #![allow(overflowing_literals)] #![allow(non_upper_case_globals)] use core_arch::arch::{target_arch}::*; diff --git a/library/stdarch/crates/std_detect/src/lib.rs b/library/stdarch/crates/std_detect/src/lib.rs index 1ff42000992d..5862ada21dbd 100644 --- a/library/stdarch/crates/std_detect/src/lib.rs +++ b/library/stdarch/crates/std_detect/src/lib.rs @@ -21,6 +21,8 @@ #![no_std] #![allow(internal_features)] // Temporary hack: needed to build against toolchains from before the mass feature renaming. +// Remove this as soon as the stdarch submodule is updated on nightly. +#![allow(stable_features)] #![feature(stdsimd)] #[cfg(test)] diff --git a/library/stdarch/crates/std_detect/tests/cpu-detection.rs b/library/stdarch/crates/std_detect/tests/cpu-detection.rs index f20ea6a2f773..8d551fc2cb7a 100644 --- a/library/stdarch/crates/std_detect/tests/cpu-detection.rs +++ b/library/stdarch/crates/std_detect/tests/cpu-detection.rs @@ -1,19 +1,20 @@ -#![feature( - stdarch_internal, - stdarch_arm_feature_detection, - stdarch_powerpc_feature_detection -)] +#![feature(stdarch_internal)] +#![cfg_attr(target_arch = "arm", feature(stdarch_arm_feature_detection))] +#![cfg_attr(target_arch = "powerpc", feature(stdarch_powerpc_feature_detection))] +#![cfg_attr(target_arch = "powerpc64", feature(stdarch_powerpc_feature_detection))] #![allow(clippy::unwrap_used, clippy::use_debug, clippy::print_stdout)] -#![cfg(any( - target_arch = "arm", - target_arch = "aarch64", - target_arch = "x86", - target_arch = "x86_64", - target_arch = "powerpc", - target_arch = "powerpc64" -))] -#[macro_use] +#[cfg_attr( + any( + target_arch = "arm", + target_arch = "aarch64", + target_arch = "x86", + target_arch = "x86_64", + target_arch = "powerpc", + target_arch = "powerpc64" + ), + macro_use +)] extern crate std_detect; #[test] diff --git a/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs b/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs index 3d5c736a053b..8304b225f53d 100644 --- a/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs +++ b/library/stdarch/crates/std_detect/tests/macro_trailing_commas.rs @@ -1,4 +1,6 @@ -#![feature(stdarch_arm_feature_detection, stdarch_powerpc_feature_detection)] +#![cfg_attr(target_arch = "arm", feature(stdarch_arm_feature_detection))] +#![cfg_attr(target_arch = "powerpc", feature(stdarch_powerpc_feature_detection))] +#![cfg_attr(target_arch = "powerpc64", feature(stdarch_powerpc_feature_detection))] #![allow(clippy::unwrap_used, clippy::use_debug, clippy::print_stdout)] #[cfg(any( diff --git a/library/stdarch/crates/stdarch-verify/tests/arm.rs b/library/stdarch/crates/stdarch-verify/tests/arm.rs index 84131c0fbecb..d6f8e69acb6c 100644 --- a/library/stdarch/crates/stdarch-verify/tests/arm.rs +++ b/library/stdarch/crates/stdarch-verify/tests/arm.rs @@ -1,8 +1,9 @@ +#![allow(unused)] + use std::collections::HashMap; use serde::Deserialize; -#[allow(unused)] struct Function { name: &'static str, arguments: &'static [&'static Type], diff --git a/library/stdarch/examples/connect5.rs b/library/stdarch/examples/connect5.rs index 6298255421ac..ffbff5e48690 100644 --- a/library/stdarch/examples/connect5.rs +++ b/library/stdarch/examples/connect5.rs @@ -28,7 +28,9 @@ //! You should see a game self-playing. In the end of the game, it shows the average time for //! each move. -#![feature(avx512_target_feature, stdarch_x86_avx512)] +#![feature(avx512_target_feature)] +#![cfg_attr(target_arch = "x86", feature(stdarch_x86_avx512))] +#![cfg_attr(target_arch = "x86_64", feature(stdarch_x86_avx512))] #![feature(stmt_expr_attributes)] use rand::seq::SliceRandom;