Skip to content

Commit

Permalink
Add ?Sized bound to some SIMD intrinsics.
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieCunliffe committed Apr 2, 2024
1 parent ae1aac0 commit 17a06d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_hir_analysis/src/check/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,7 @@ pub fn check_intrinsic_type(
sym::simd_cast
| sym::simd_as
| sym::simd_cast_ptr
| sym::simd_reinterpret
| sym::simd_expose_addr
| sym::simd_from_exposed_addr => (2, 0, vec![param(0)], param(1)),
sym::simd_bitmask => (2, 0, vec![param(0)], param(1)),
Expand Down
8 changes: 6 additions & 2 deletions library/core/src/intrinsics/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ extern "rust-intrinsic" {
/// * Not be infinite
/// * Be representable in the return type, after truncating off its fractional part
#[rustc_nounwind]
pub fn simd_cast<T, U>(x: T) -> U;
pub fn simd_cast<T: ?Sized, U: ?Sized>(x: T) -> U;

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

#[cfg(not(bootstrap))]
#[rustc_nounwind]
pub fn simd_reinterpret<Src: ?Sized, Dst: ?Sized>(src: Src) -> Dst;

/// Elementwise negation of a vector.
///
/// `T` must be a vector of integer or floating-point primitive types.
Expand Down Expand Up @@ -500,7 +504,7 @@ extern "rust-intrinsic" {
/// # Safety
/// `mask` must only contain `0` and `!0`.
#[rustc_nounwind]
pub fn simd_select<M, T>(mask: M, if_true: T, if_false: T) -> T;
pub fn simd_select<M: ?Sized, T: ?Sized>(mask: M, if_true: T, if_false: T) -> T;

/// Select elements from a bitmask.
///
Expand Down

0 comments on commit 17a06d9

Please sign in to comment.