Skip to content

Commit 17a06d9

Browse files
committed
Add ?Sized bound to some SIMD intrinsics.
1 parent ae1aac0 commit 17a06d9

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
@@ -623,6 +623,7 @@ pub fn check_intrinsic_type(
623623
sym::simd_cast
624624
| sym::simd_as
625625
| sym::simd_cast_ptr
626+
| sym::simd_reinterpret
626627
| sym::simd_expose_addr
627628
| sym::simd_from_exposed_addr => (2, 0, vec![param(0)], param(1)),
628629
sym::simd_bitmask => (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.
@@ -500,7 +504,7 @@ extern "rust-intrinsic" {
500504
/// # Safety
501505
/// `mask` must only contain `0` and `!0`.
502506
#[rustc_nounwind]
503-
pub fn simd_select<M, T>(mask: M, if_true: T, if_false: T) -> T;
507+
pub fn simd_select<M: ?Sized, T: ?Sized>(mask: M, if_true: T, if_false: T) -> T;
504508

505509
/// Select elements from a bitmask.
506510
///

0 commit comments

Comments
 (0)