Skip to content

Commit 297b77d

Browse files
Add E0442 error explanation
1 parent 954d6ae commit 297b77d

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/librustc_typeck/diagnostics.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3047,6 +3047,38 @@ extern "platform-intrinsic" {
30473047
```
30483048
"##,
30493049

3050+
E0442: r##"
3051+
Intrinsic argument(s) and/or return value have the wrong length.
3052+
Erroneous code example:
3053+
3054+
```
3055+
#[repr(simd)]
3056+
struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8,
3057+
i8, i8, i8, i8, i8, i8, i8, i8);
3058+
#[repr(simd)]
3059+
struct i32x4(i32, i32, i32, i32);
3060+
#[repr(simd)]
3061+
struct i64x2(i64, i64);
3062+
3063+
extern "platform-intrinsic" {
3064+
fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
3065+
// error: intrinsic arguments have wrong length
3066+
}
3067+
```
3068+
3069+
To fix this error, please refer to the function declaration to give
3070+
it the awaited types with the awaited length. Example:
3071+
3072+
```
3073+
#[repr(simd)]
3074+
struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
3075+
3076+
extern "platform-intrinsic" {
3077+
fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok!
3078+
}
3079+
```
3080+
"##
3081+
30503082
}
30513083

30523084
register_diagnostics! {
@@ -3131,7 +3163,6 @@ register_diagnostics! {
31313163
E0439, // invalid `simd_shuffle`, needs length: `{}`
31323164
E0440, // platform-specific intrinsic has wrong number of type parameters
31333165
E0441, // unrecognized platform-specific intrinsic function
3134-
E0442, // intrinsic {} has wrong type: found {}, expected {}
31353166
E0443, // intrinsic {} has wrong type: found `{}`, expected `{}` which
31363167
// was used for this vector type previously in this signature
31373168
}

0 commit comments

Comments
 (0)