Skip to content

Commit ba990ae

Browse files
authored
Rollup merge of #128150 - BoxyUwU:std_only_sized_const_params, r=workingjubilee
Stop using `unsized_const_parameters` in core/std `feature(unsized_const_parameters)` is an incomplete feature and should not be used by core/std as it makes it can make it significantly harder to evolve the feature. It also just generally opens the possibility of introducing bugs on stable through std's backdoor. The only usage of this feature in std is the `simd_shuffle_intrinsic` added in #119213. It doesn't seem to be used anywhere as far as I can tell so it is removed in this PR. All tests and codegen logic etc have been kept however. r? `@workingjubilee`
2 parents f345c5e + 8174f9b commit ba990ae

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

library/core/src/intrinsics/simd.rs

-12
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,6 @@ extern "rust-intrinsic" {
243243
#[rustc_nounwind]
244244
pub fn simd_shuffle<T, U, V>(x: T, y: T, idx: U) -> V;
245245

246-
/// Shuffle two vectors by const indices.
247-
///
248-
/// `T` must be a vector.
249-
///
250-
/// `U` must be a vector with the same element type as `T` and the same length as `IDX`.
251-
///
252-
/// Returns a new vector such that element `i` is selected from `xy[IDX[i]]`, where `xy`
253-
/// is the concatenation of `x` and `y`. It is a compile-time error if `IDX[i]` is out-of-bounds
254-
/// of `xy`.
255-
#[rustc_nounwind]
256-
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
257-
258246
/// Read a vector of pointers.
259247
///
260248
/// `T` must be a vector.

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@
249249
#![feature(transparent_unions)]
250250
#![feature(try_blocks)]
251251
#![feature(unboxed_closures)]
252-
#![feature(unsized_const_params)]
253252
#![feature(unsized_fn_params)]
254253
#![feature(with_negative_coherence)]
255254
// tidy-alphabetical-end

library/core/src/marker.rs

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ use crate::hash::Hasher;
4242
/// }
4343
/// ```
4444
#[unstable(feature = "internal_impls_macro", issue = "none")]
45+
// Allow implementations of `UnsizedConstParamTy` even though std cannot use that feature.
46+
#[allow_internal_unstable(unsized_const_params)]
4547
macro marker_impls {
4648
( $(#[$($meta:tt)*])* $Trait:ident for $({$($bounds:tt)*})? $T:ty $(, $($rest:tt)*)? ) => {
4749
$(#[$($meta)*])* impl< $($($bounds)*)? > $Trait for $T {}

src/tools/miri/tests/pass/intrinsics/portable-simd.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
//@compile-flags: -Zmiri-strict-provenance
2-
#![feature(portable_simd, adt_const_params, core_intrinsics, repr_simd)]
2+
#![feature(
3+
portable_simd,
4+
unsized_const_params,
5+
adt_const_params,
6+
rustc_attrs,
7+
intrinsics,
8+
core_intrinsics,
9+
repr_simd
10+
)]
311
#![allow(incomplete_features, internal_features)]
412
use std::intrinsics::simd as intrinsics;
513
use std::ptr;
614
use std::simd::{prelude::*, StdFloat};
715

16+
extern "rust-intrinsic" {
17+
#[rustc_nounwind]
18+
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
19+
}
20+
821
fn simd_ops_f32() {
922
let a = f32x4::splat(10.0);
1023
let b = f32x4::from_array([1.0, 2.0, 3.0, -4.0]);

0 commit comments

Comments
 (0)