Closed
Description
This is a much abbreviated version of the code from my experiments with adding a shuffle API to the stdsimd repo, it probably needs further reduction but I wanted to file this before I forgot:
#![feature(const_generics, repr_simd, platform_intrinsics)]
#[repr(simd)]
pub struct SimdU32<const LANES: usize>([u32; LANES]);
impl<const LANES: usize> SimdU32<LANES> {
pub fn shuffle2<const M: [u32; 2]>(self, other: Self) -> SimdU32<2> {
// this is just the rustc platform intrinsic, don't worry too much about what it's doing
unsafe { crate::intrinsics::simd_shuffle2(self, other, M) }
}
}
// and now in another file, over in the tests...
use core_simd::SimdU32;
#[test]
fn attempt_shuffle() {
let a = SimdU32::from_array([2, 4, 1, 9]);
let b = a;
let c = a.shuffle2::<[3, 1]>(b);
}
I expected to see this happen: it works, provides a useful error, or even just ICEs.
Instead, this happened: I got a request to input a type instead!
error: unmatched angle bracket
--> crates/core_simd/tests/permute.rs:11:25
|
11 | let c = a.shuffle2::<[3, 1]>(b);
| ^ help: remove extra angle bracket
error: expected type, found `3`
--> crates/core_simd/tests/permute.rs:11:27
|
11 | let c = a.shuffle2::<[3, 1]>(b);
| ^ expected type
And no, that doesn't work either if you put it in, because instead you get:
error[E0747]: type provided when a constant was expected
--> crates/core_simd/tests/permute.rs:9:26
|
9 | let c = a.shuffle2::<[u32; 2]>(b);
| ^^^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0747`.
Meta
rustc --version --verbose
:
rustc 1.51.0-nightly (a2f8f6281 2021-01-27)
binary: rustc
commit-hash: a2f8f6281817d430e20726128b739d3c6708561c
commit-date: 2021-01-27
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly
LLVM version: 11.0.1