Summary
In compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs, both simd_shuffle and simd_shuffle_const_generic error messages report the output vector length (dest_len) instead of the input vector length (left_len) when an index is out-of-bounds.
Location
compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs, lines 576 and 605
Bug
The valid index range for simd_shuffle is [0, left_len + right_len) where left_len == right_len (the input vectors). The error message says:
`simd_shuffle` index {src_index} is out-of-bounds for 2 vectors with length {dest_len}
dest_len is the OUTPUT vector length, not each input vector's length. When dest_len != left_len, the message reports the wrong valid range.
Example: If input vectors have 4 elements each (left_len=4) and output has 8 elements (dest_len=8), valid indices are 0..8. The error message says "out-of-bounds for 2 vectors with length 8", suggesting valid range 0..16. The correct message should say "with length 4".
Fix
Replace {dest_len} with {left_len} in both error messages.
Summary
In
compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs, bothsimd_shuffleandsimd_shuffle_const_genericerror messages report the output vector length (dest_len) instead of the input vector length (left_len) when an index is out-of-bounds.Location
compiler/rustc_const_eval/src/interpret/intrinsics/simd.rs, lines 576 and 605Bug
The valid index range for simd_shuffle is
[0, left_len + right_len)whereleft_len == right_len(the input vectors). The error message says:dest_lenis the OUTPUT vector length, not each input vector's length. Whendest_len != left_len, the message reports the wrong valid range.Example: If input vectors have 4 elements each (
left_len=4) and output has 8 elements (dest_len=8), valid indices are0..8. The error message says "out-of-bounds for 2 vectors with length 8", suggesting valid range0..16. The correct message should say "with length 4".Fix
Replace
{dest_len}with{left_len}in both error messages.