Closed
Description
I tried this code:
use std::arch::x86_64::*;
struct Test<const X: u8>;
impl<const X: u8> Test<X> {
const Y: i32 = (X | (X << 2) | (X << 4) | (X << 6)) as i32;
unsafe fn f(v: __m128i) -> __m128i {
_mm_shufflelo_epi16(v, Self::Y)
}
}
I expected to see this happen:
This code was accepted in Rust 1.53, so newer versions should also accept it.
Instead, this happened:
error: generic `Self` types are currently not permitted in anonymous constants
--> <source>:9:32
|
9 | _mm_shufflelo_epi16(v, Self::Y)
| ^^^^
|
note: not a concrete type
--> <source>:5:19
|
5 | impl<const X: u8> Test<X> {
| ^^^^^^^
error: aborting due to previous error
Meta
Tested using rustc 1.53 and 1.54 (and newer) from Compiler Explorer.
Metadata
Metadata
Assignees
Labels
Area: SIMD (Single Instruction Multiple Data)Area: const generics (parameters and arguments)Category: This is a bug.High priorityProject group: Const genericsRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.