Skip to content

Commit 21a2557

Browse files
RalfJungAmanieu
authored andcommitted
avoid rustc_const_stable on internal function
1 parent 6f48adc commit 21a2557

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

crates/core_arch/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
asm_experimental_arch,
3737
sha512_sm_x86,
3838
x86_amx_intrinsics,
39-
f16
39+
f16,
40+
rustc_allow_const_fn_unstable
4041
)]
4142
#![cfg_attr(test, feature(test, abi_vectorcall, stdarch_internal))]
4243
#![deny(clippy::missing_inline_in_public_items)]
@@ -72,6 +73,10 @@
7273
stdarch_loongarch_feature_detection
7374
)
7475
)]
76+
#![cfg_attr(
77+
any(target_arch = "wasm32", target_arch = "wasm64", doc),
78+
feature(wasm_simd_const_internals)
79+
)]
7580

7681
#[cfg(test)]
7782
#[macro_use]

crates/core_arch/src/wasm32/simd128.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ macro_rules! conversions {
5151
$(
5252
impl $ty {
5353
#[inline(always)]
54-
#[rustc_const_stable(feature = "wasm_simd_const", since = "1.56.0")]
54+
// FIXME remove next line when const-stability v2 migration is done
55+
#[rustc_const_unstable(feature = "wasm_simd_const_internals", issue = "none")]
5556
pub(crate) const fn v128(self) -> v128 {
5657
unsafe { mem::transmute(self) }
5758
}
@@ -664,6 +665,7 @@ pub unsafe fn v128_store64_lane<const L: usize>(v: v128, m: *mut u64) {
664665
#[doc(alias("v128.const"))]
665666
#[stable(feature = "wasm_simd", since = "1.54.0")]
666667
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
668+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
667669
pub const fn i8x16(
668670
a0: i8,
669671
a1: i8,
@@ -696,6 +698,7 @@ pub const fn i8x16(
696698
#[doc(alias("v128.const"))]
697699
#[stable(feature = "wasm_simd", since = "1.54.0")]
698700
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
701+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
699702
pub const fn u8x16(
700703
a0: u8,
701704
a1: u8,
@@ -742,6 +745,7 @@ pub const fn u8x16(
742745
#[doc(alias("v128.const"))]
743746
#[stable(feature = "wasm_simd", since = "1.54.0")]
744747
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
748+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
745749
pub const fn i16x8(a0: i16, a1: i16, a2: i16, a3: i16, a4: i16, a5: i16, a6: i16, a7: i16) -> v128 {
746750
simd::i16x8::new(a0, a1, a2, a3, a4, a5, a6, a7).v128()
747751
}
@@ -754,6 +758,7 @@ pub const fn i16x8(a0: i16, a1: i16, a2: i16, a3: i16, a4: i16, a5: i16, a6: i16
754758
#[doc(alias("v128.const"))]
755759
#[stable(feature = "wasm_simd", since = "1.54.0")]
756760
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
761+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
757762
pub const fn u16x8(a0: u16, a1: u16, a2: u16, a3: u16, a4: u16, a5: u16, a6: u16, a7: u16) -> v128 {
758763
simd::u16x8::new(a0, a1, a2, a3, a4, a5, a6, a7).v128()
759764
}
@@ -767,6 +772,7 @@ pub const fn u16x8(a0: u16, a1: u16, a2: u16, a3: u16, a4: u16, a5: u16, a6: u16
767772
#[doc(alias("v128.const"))]
768773
#[stable(feature = "wasm_simd", since = "1.54.0")]
769774
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
775+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
770776
pub const fn i32x4(a0: i32, a1: i32, a2: i32, a3: i32) -> v128 {
771777
simd::i32x4::new(a0, a1, a2, a3).v128()
772778
}
@@ -779,6 +785,7 @@ pub const fn i32x4(a0: i32, a1: i32, a2: i32, a3: i32) -> v128 {
779785
#[doc(alias("v128.const"))]
780786
#[stable(feature = "wasm_simd", since = "1.54.0")]
781787
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
788+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
782789
pub const fn u32x4(a0: u32, a1: u32, a2: u32, a3: u32) -> v128 {
783790
simd::u32x4::new(a0, a1, a2, a3).v128()
784791
}
@@ -792,6 +799,7 @@ pub const fn u32x4(a0: u32, a1: u32, a2: u32, a3: u32) -> v128 {
792799
#[doc(alias("v128.const"))]
793800
#[stable(feature = "wasm_simd", since = "1.54.0")]
794801
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
802+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
795803
pub const fn i64x2(a0: i64, a1: i64) -> v128 {
796804
simd::i64x2::new(a0, a1).v128()
797805
}
@@ -804,6 +812,7 @@ pub const fn i64x2(a0: i64, a1: i64) -> v128 {
804812
#[doc(alias("v128.const"))]
805813
#[stable(feature = "wasm_simd", since = "1.54.0")]
806814
#[rustc_const_stable(feature = "wasm_simd", since = "1.54.0")]
815+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
807816
pub const fn u64x2(a0: u64, a1: u64) -> v128 {
808817
simd::u64x2::new(a0, a1).v128()
809818
}
@@ -817,6 +826,7 @@ pub const fn u64x2(a0: u64, a1: u64) -> v128 {
817826
#[doc(alias("v128.const"))]
818827
#[stable(feature = "wasm_simd", since = "1.54.0")]
819828
#[rustc_const_stable(feature = "wasm_simd_const", since = "1.56.0")]
829+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
820830
pub const fn f32x4(a0: f32, a1: f32, a2: f32, a3: f32) -> v128 {
821831
simd::f32x4::new(a0, a1, a2, a3).v128()
822832
}
@@ -830,6 +840,7 @@ pub const fn f32x4(a0: f32, a1: f32, a2: f32, a3: f32) -> v128 {
830840
#[doc(alias("v128.const"))]
831841
#[stable(feature = "wasm_simd", since = "1.54.0")]
832842
#[rustc_const_stable(feature = "wasm_simd_const", since = "1.56.0")]
843+
#[rustc_allow_const_fn_unstable(wasm_simd_const_internals)] // FIXME remove when const-stability v2 migration is done
833844
pub const fn f64x2(a0: f64, a1: f64) -> v128 {
834845
simd::f64x2::new(a0, a1).v128()
835846
}

0 commit comments

Comments
 (0)