diff options
| author | Caleb Zulawski <caleb.zulawski@gmail.com> | 2021-09-08 20:01:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-08 17:01:16 -0700 |
| commit | 8cf7a62e5d2552961df51e5200aaa5b7c890a4bf (patch) | |
| tree | 456e06d7260af4d62a31ceef79422f5caee7126b | |
| parent | d42875302dd9e924f8d667b32e88989388989b79 (diff) | |
| download | rust-8cf7a62e5d2552961df51e5200aaa5b7c890a4bf.tar.gz rust-8cf7a62e5d2552961df51e5200aaa5b7c890a4bf.zip | |
Fix cargo features for nightly (#155)
* Fix cargo features for nightly
| -rw-r--r-- | .github/workflows/ci.yml | 4 | ||||
| -rw-r--r-- | crates/core_simd/Cargo.toml | 4 | ||||
| -rw-r--r-- | crates/core_simd/src/lib.rs | 8 | ||||
| -rw-r--r-- | crates/core_simd/src/masks.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/src/masks/bitmask.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/src/masks/full_masks.rs | 2 | ||||
| -rw-r--r-- | crates/core_simd/tests/masks.rs | 1 | ||||
| -rw-r--r-- | crates/core_simd/tests/to_bytes.rs | 4 |
8 files changed, 17 insertions, 10 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 454bc315475..a9768f53852 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -208,8 +208,8 @@ jobs: features: - "" - "--features std" - - "--features const_evaluatable_checked" - - "--features std --features const_evaluatable_checked" + - "--features generic_const_exprs" + - "--features std --features generic_const_exprs" steps: - uses: actions/checkout@v2 diff --git a/crates/core_simd/Cargo.toml b/crates/core_simd/Cargo.toml index c45dde2dbd2..9e8d742d83c 100644 --- a/crates/core_simd/Cargo.toml +++ b/crates/core_simd/Cargo.toml @@ -9,9 +9,9 @@ categories = ["hardware-support", "no-std"] license = "MIT OR Apache-2.0" [features] -default = ["std", "const_evaluatable_checked"] +default = ["std", "generic_const_exprs"] std = [] -const_evaluatable_checked = [] +generic_const_exprs = [] [target.'cfg(target_arch = "wasm32")'.dev-dependencies.wasm-bindgen] version = "0.2" diff --git a/crates/core_simd/src/lib.rs b/crates/core_simd/src/lib.rs index fc0df1813b9..7f07aa6393e 100644 --- a/crates/core_simd/src/lib.rs +++ b/crates/core_simd/src/lib.rs @@ -1,15 +1,15 @@ -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] #![allow(incomplete_features)] #![feature( - const_evaluatable_checked, + adt_const_params, const_fn_trait_bound, - const_generics, platform_intrinsics, repr_simd, simd_ffi, staged_api, stdsimd )] +#![cfg_attr(feature = "generic_const_exprs", feature(generic_const_exprs))] #![warn(missing_docs)] #![unstable(feature = "portable_simd", issue = "86656")] //! Portable SIMD module. @@ -22,7 +22,7 @@ mod reduction; mod select; pub use select::Select; -#[cfg(feature = "const_evaluatable_checked")] +#[cfg(feature = "generic_const_exprs")] mod to_bytes; mod comparisons; diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs index 14b1fe08ffb..ebd394cd040 100644 --- a/crates/core_simd/src/masks.rs +++ b/crates/core_simd/src/masks.rs @@ -178,11 +178,13 @@ where } /// Convert this mask to a bitmask, with one bit set per lane. + #[cfg(feature = "generic_const_exprs")] pub fn to_bitmask(self) -> [u8; LaneCount::<LANES>::BITMASK_LEN] { self.0.to_bitmask() } /// Convert a bitmask to a mask. + #[cfg(feature = "generic_const_exprs")] pub fn from_bitmask(bitmask: [u8; LaneCount::<LANES>::BITMASK_LEN]) -> Self { Self(mask_impl::Mask::from_bitmask(bitmask)) } diff --git a/crates/core_simd/src/masks/bitmask.rs b/crates/core_simd/src/masks/bitmask.rs index 0b5b3a5c595..bc68b507674 100644 --- a/crates/core_simd/src/masks/bitmask.rs +++ b/crates/core_simd/src/masks/bitmask.rs @@ -119,12 +119,14 @@ where Self(core::mem::transmute_copy(&mask), PhantomData) } + #[cfg(feature = "generic_const_exprs")] #[inline] pub fn to_bitmask(self) -> [u8; LaneCount::<LANES>::BITMASK_LEN] { // Safety: these are the same type and we are laundering the generic unsafe { core::mem::transmute_copy(&self.0) } } + #[cfg(feature = "generic_const_exprs")] #[inline] pub fn from_bitmask(bitmask: [u8; LaneCount::<LANES>::BITMASK_LEN]) -> Self { // Safety: these are the same type and we are laundering the generic diff --git a/crates/core_simd/src/masks/full_masks.rs b/crates/core_simd/src/masks/full_masks.rs index 9c1cc4623f9..5b783a7b6a1 100644 --- a/crates/core_simd/src/masks/full_masks.rs +++ b/crates/core_simd/src/masks/full_masks.rs @@ -101,6 +101,7 @@ where unsafe { Mask(crate::intrinsics::simd_cast(self.0)) } } + #[cfg(feature = "generic_const_exprs")] #[inline] pub fn to_bitmask(self) -> [u8; LaneCount::<LANES>::BITMASK_LEN] { unsafe { @@ -127,6 +128,7 @@ where } } + #[cfg(feature = "generic_const_exprs")] #[inline] pub fn from_bitmask(mut bitmask: [u8; LaneCount::<LANES>::BITMASK_LEN]) -> Self { unsafe { diff --git a/crates/core_simd/tests/masks.rs b/crates/core_simd/tests/masks.rs index cf8039d153d..c2d400d79d4 100644 --- a/crates/core_simd/tests/masks.rs +++ b/crates/core_simd/tests/masks.rs @@ -68,6 +68,7 @@ macro_rules! test_mask_api { assert_eq!(core_simd::Mask::<$type, 8>::from_int(int), mask); } + #[cfg(feature = "generic_const_exprs")] #[test] fn roundtrip_bitmask_conversion() { let values = [ diff --git a/crates/core_simd/tests/to_bytes.rs b/crates/core_simd/tests/to_bytes.rs index c66c9d5bd36..debb4335e2c 100644 --- a/crates/core_simd/tests/to_bytes.rs +++ b/crates/core_simd/tests/to_bytes.rs @@ -1,6 +1,6 @@ -#![feature(portable_simd, const_generics, const_evaluatable_checked)] +#![feature(portable_simd, generic_const_exprs, adt_const_params)] #![allow(incomplete_features)] -#![cfg(feature = "const_evaluatable_checked")] +#![cfg(feature = "generic_const_exprs")] use core_simd::Simd; |
