Skip to content

Commit 9259418

Browse files
Add E0443 error explanation
1 parent 297b77d commit 9259418

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

src/librustc_typeck/diagnostics.rs

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,54 +3020,56 @@ parameters. You can read more about it in the API documentation:
30203020
https://doc.rust-lang.org/std/marker/struct.PhantomData.html
30213021
"##,
30223022

3023-
E0444: r##"
3024-
A platform-specific intrinsic function has wrong number of arguments.
3023+
E0442: r##"
3024+
Intrinsic argument(s) and/or return value have the wrong length.
30253025
Erroneous code example:
30263026
30273027
```
30283028
#[repr(simd)]
3029-
struct f64x2(f64, f64);
3029+
struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8,
3030+
i8, i8, i8, i8, i8, i8, i8, i8);
3031+
#[repr(simd)]
3032+
struct i32x4(i32, i32, i32, i32);
3033+
#[repr(simd)]
3034+
struct i64x2(i64, i64);
30303035
30313036
extern "platform-intrinsic" {
3032-
fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32;
3033-
// error: platform-specific intrinsic has invalid number of arguments
3037+
fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
3038+
// error: intrinsic arguments/return value have wrong length
30343039
}
30353040
```
30363041
3037-
Please refer to the function declaration to see if it corresponds
3038-
with yours. Example:
3042+
To fix this error, please refer to the function declaration to give
3043+
it the awaited types with the awaited length. Example:
30393044
30403045
```
30413046
#[repr(simd)]
3042-
struct f64x2(f64, f64);
3047+
struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
30433048
30443049
extern "platform-intrinsic" {
3045-
fn x86_mm_movemask_pd(x: f64x2) -> i32; // ok!
3050+
fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok!
30463051
}
30473052
```
30483053
"##,
30493054

3050-
E0442: r##"
3051-
Intrinsic argument(s) and/or return value have the wrong length.
3055+
E0443: r##"
3056+
Intrinsic argument(s) and/or return value have the wrong type.
30523057
Erroneous code example:
30533058
30543059
```
30553060
#[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);
3061+
struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
30603062
#[repr(simd)]
3061-
struct i64x2(i64, i64);
3063+
struct i64x8(i64, i64, i64, i64, i64, i64, i64, i64);
30623064
30633065
extern "platform-intrinsic" {
3064-
fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
3065-
// error: intrinsic arguments have wrong length
3066+
fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8;
3067+
// error: intrinsic argument/return value has wrong type
30663068
}
30673069
```
30683070
30693071
To fix this error, please refer to the function declaration to give
3070-
it the awaited types with the awaited length. Example:
3072+
it the awaited types. Example:
30713073
30723074
```
30733075
#[repr(simd)]
@@ -3077,7 +3079,34 @@ extern "platform-intrinsic" {
30773079
fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok!
30783080
}
30793081
```
3080-
"##
3082+
"##,
3083+
3084+
E0444: r##"
3085+
A platform-specific intrinsic function has wrong number of arguments.
3086+
Erroneous code example:
3087+
3088+
```
3089+
#[repr(simd)]
3090+
struct f64x2(f64, f64);
3091+
3092+
extern "platform-intrinsic" {
3093+
fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32;
3094+
// error: platform-specific intrinsic has invalid number of arguments
3095+
}
3096+
```
3097+
3098+
Please refer to the function declaration to see if it corresponds
3099+
with yours. Example:
3100+
3101+
```
3102+
#[repr(simd)]
3103+
struct f64x2(f64, f64);
3104+
3105+
extern "platform-intrinsic" {
3106+
fn x86_mm_movemask_pd(x: f64x2) -> i32; // ok!
3107+
}
3108+
```
3109+
"##,
30813110

30823111
}
30833112

@@ -3163,6 +3192,4 @@ register_diagnostics! {
31633192
E0439, // invalid `simd_shuffle`, needs length: `{}`
31643193
E0440, // platform-specific intrinsic has wrong number of type parameters
31653194
E0441, // unrecognized platform-specific intrinsic function
3166-
E0443, // intrinsic {} has wrong type: found `{}`, expected `{}` which
3167-
// was used for this vector type previously in this signature
31683195
}

0 commit comments

Comments
 (0)