Skip to content

Commit d5834cc

Browse files
committed
Add ?Sized bound to some SIMD intrinsics.
1 parent dace184 commit d5834cc

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

compiler/rustc_hir_analysis/src/check/intrinsic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,7 @@ pub fn check_intrinsic_type(
642642
sym::simd_extract => (2, 0, vec![param(0), tcx.types.u32], param(1)),
643643
sym::simd_cast
644644
| sym::simd_as
645+
| sym::simd_reinterpret
645646
| sym::simd_cast_ptr
646647
| sym::simd_expose_provenance
647648
| sym::simd_with_exposed_provenance => (2, 0, vec![param(0)], param(1)),

library/core/src/intrinsics/simd.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ extern "rust-intrinsic" {
122122
/// * Not be infinite
123123
/// * Be representable in the return type, after truncating off its fractional part
124124
#[rustc_nounwind]
125-
pub fn simd_cast<T, U>(x: T) -> U;
125+
pub fn simd_cast<T: ?Sized, U: ?Sized>(x: T) -> U;
126126

127127
/// Numerically cast a vector, elementwise.
128128
///
@@ -138,6 +138,10 @@ extern "rust-intrinsic" {
138138
#[rustc_nounwind]
139139
pub fn simd_as<T, U>(x: T) -> U;
140140

141+
#[cfg(not(bootstrap))]
142+
#[rustc_nounwind]
143+
pub fn simd_reinterpret<Src: ?Sized, Dst: ?Sized>(src: Src) -> Dst;
144+
141145
/// Elementwise negation of a vector.
142146
///
143147
/// `T` must be a vector of integer or floating-point primitive types.
@@ -504,7 +508,7 @@ extern "rust-intrinsic" {
504508
/// # Safety
505509
/// `mask` must only contain `0` and `!0`.
506510
#[rustc_nounwind]
507-
pub fn simd_select<M, T>(mask: M, if_true: T, if_false: T) -> T;
511+
pub fn simd_select<M: ?Sized, T: ?Sized>(mask: M, if_true: T, if_false: T) -> T;
508512

509513
/// Select elements from a bitmask.
510514
///

0 commit comments

Comments
 (0)