From 7a5fd09696d854ae71ca0775d2d559f3b778a33e Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 23 Sep 2023 14:46:47 +0900 Subject: [PATCH] Remove #![feature(stdsimd)] used for Miri/ThreadSanitizer --- bench/benches/bench.rs | 2 +- build.rs | 4 ++++ src/lib.rs | 9 ++++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/bench/benches/bench.rs b/bench/benches/bench.rs index 02bd7d3d..4b71ab74 100644 --- a/bench/benches/bench.rs +++ b/bench/benches/bench.rs @@ -3,7 +3,7 @@ #![warn(rust_2018_idioms, single_use_lifetimes, unsafe_op_in_unsafe_fn)] #![allow(dead_code, unused_extern_crates)] #![allow(clippy::only_used_in_recursion)] -#![feature(asm_experimental_arch, core_intrinsics, stdsimd)] +#![feature(asm_experimental_arch, core_intrinsics)] use std::{ hint::black_box, diff --git a/build.rs b/build.rs index 9db9d0dc..bd33b395 100644 --- a/build.rs +++ b/build.rs @@ -147,6 +147,10 @@ fn main() { if target_arch == "arm" && !version.probe(67, 2022, 11, 5) { println!("cargo:rustc-cfg=portable_atomic_unstable_isa_attribute"); } + // https://github.com/rust-lang/rust/pull/109359 (includes https://github.com/rust-lang/stdarch/pull/1358) merged in Rust 1.70 (nightly-2023-03-24). + if target_arch == "x86_64" && !version.probe(70, 2023, 3, 23) { + println!("cargo:rustc-cfg=portable_atomic_unstable_cmpxchg16b_intrinsic"); + } // `cfg(sanitize = "..")` is not stabilized. let sanitize = env::var("CARGO_CFG_SANITIZE").unwrap_or_default(); diff --git a/src/lib.rs b/src/lib.rs index 4fa69e9c..8e7d2a99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -320,10 +320,13 @@ RUSTFLAGS="--cfg portable_atomic_no_outline_atomics" cargo ... ), feature(core_intrinsics) )] -// This feature will be unnecessary once stdarch submodule in rust-lang/rust is -// updated to include https://github.com/rust-lang/stdarch/pull/1358. +// This feature is only enabled for old nightly. #![cfg_attr( - all(target_arch = "x86_64", any(miri, portable_atomic_sanitize_thread)), + all( + target_arch = "x86_64", + portable_atomic_unstable_cmpxchg16b_intrinsic, + any(miri, portable_atomic_sanitize_thread), + ), feature(stdsimd) )] // docs.rs only