Skip to content

Commit

Permalink
Unpromote unstable const fns
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Jun 11, 2018
1 parent 5987521 commit bc783d2
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 11 deletions.
4 changes: 0 additions & 4 deletions coresimd/ppsv/api/masks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,25 @@ macro_rules! impl_mask_minimal {
/// Creates a new instance with each vector elements initialized
/// with the provided values.
#[inline]
#[promotable_const_fn]
pub const fn new($($elem_name: bool),*) -> Self {
$id($(Self::bool_to_internal($elem_name)),*)
}

/// Converts a boolean type into the type of the vector lanes.
#[inline]
#[promotable_const_fn]
const fn bool_to_internal(x: bool) -> $elem_ty {
[0 as $elem_ty, !(0 as $elem_ty)][x as usize]
}

/// Returns the number of vector lanes.
#[inline]
#[promotable_const_fn]
pub const fn lanes() -> usize {
$elem_count
}

/// Constructs a new instance with each element initialized to
/// `value`.
#[inline]
#[promotable_const_fn]
pub const fn splat(value: bool) -> Self {
$id($({
#[allow(non_camel_case_types, dead_code)]
Expand Down
3 changes: 0 additions & 3 deletions coresimd/ppsv/api/minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@ macro_rules! impl_minimal {
/// Creates a new instance with each vector elements initialized
/// with the provided values.
#[inline]
#[promotable_const_fn]
pub const fn new($($elem_name: $elem_ty),*) -> Self {
$id($($elem_name),*)
}

/// Returns the number of vector lanes.
#[inline]
#[promotable_const_fn]
pub const fn lanes() -> usize {
$elem_count
}

/// Constructs a new instance with each element initialized to
/// `value`.
#[inline]
#[promotable_const_fn]
pub const fn splat(value: $elem_ty) -> Self {
$id($({
#[allow(non_camel_case_types, dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion crates/coresimd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
staged_api, core_float, core_slice_ext, align_offset,
doc_cfg, mmx_target_feature, tbm_target_feature,
sse4a_target_feature, arm_target_feature, aarch64_target_feature,
mips_target_feature, powerpc_target_feature, promotable_const_fn)]
mips_target_feature, powerpc_target_feature)]
#![cfg_attr(test,
feature(proc_macro, test, attr_literals, abi_vectorcall,
untagged_unions))]
Expand Down
2 changes: 1 addition & 1 deletion crates/stdsimd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#![feature(const_fn, integer_atomics, staged_api, stdsimd)]
#![feature(doc_cfg, allow_internal_unstable)]
#![feature(promotable_const_fn)]
#![feature(promotable_const_fn, custom_attributes)]
#![cfg_attr(feature = "cargo-clippy", allow(shadow_reuse))]
#![cfg_attr(target_os = "linux", feature(linkage))]
#![no_std]
Expand Down
2 changes: 0 additions & 2 deletions stdsimd/arch/detect/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ struct Cache(AtomicU64);
#[cfg(target_pointer_width = "64")]
impl Cache {
/// Creates an uninitialized cache.
#[promotable_const_fn]
const fn uninitialized() -> Self {
Cache(AtomicU64::new(u64::max_value()))
}
Expand Down Expand Up @@ -105,7 +104,6 @@ struct Cache(AtomicU32, AtomicU32);
#[cfg(target_pointer_width = "32")]
impl Cache {
/// Creates an uninitialized cache.
#[promotable_const_fn]
const fn uninitialized() -> Self {
Cache(
AtomicU32::new(u32::max_value()),
Expand Down

0 comments on commit bc783d2

Please sign in to comment.