diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-08-28 16:13:14 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2015-09-01 01:22:43 +0200 |
| commit | 9259418d26f3b9197efedf9aa01bbc3967bb9628 (patch) | |
| tree | 7d0e33e18a69923302a991affaedda9ed2b13759 | |
| parent | 297b77d49b2961c682e11fafb975f27780ba5625 (diff) | |
| download | rust-9259418d26f3b9197efedf9aa01bbc3967bb9628.tar.gz rust-9259418d26f3b9197efedf9aa01bbc3967bb9628.zip | |
Add E0443 error explanation
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 71 |
1 files changed, 49 insertions, 22 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index c407d2f319d..1ec32bd3b1e 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -3020,54 +3020,56 @@ parameters. You can read more about it in the API documentation: https://doc.rust-lang.org/std/marker/struct.PhantomData.html "##, -E0444: r##" -A platform-specific intrinsic function has wrong number of arguments. +E0442: r##" +Intrinsic argument(s) and/or return value have the wrong length. Erroneous code example: ``` #[repr(simd)] -struct f64x2(f64, f64); +struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, + i8, i8, i8, i8, i8, i8, i8, i8); +#[repr(simd)] +struct i32x4(i32, i32, i32, i32); +#[repr(simd)] +struct i64x2(i64, i64); extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; - // error: platform-specific intrinsic has invalid number of arguments + fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; + // error: intrinsic arguments/return value have wrong length } ``` -Please refer to the function declaration to see if it corresponds -with yours. Example: +To fix this error, please refer to the function declaration to give +it the awaited types with the awaited length. Example: ``` #[repr(simd)] -struct f64x2(f64, f64); +struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); extern "platform-intrinsic" { - fn x86_mm_movemask_pd(x: f64x2) -> i32; // ok! + fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok! } ``` "##, -E0442: r##" -Intrinsic argument(s) and/or return value have the wrong length. +E0443: r##" +Intrinsic argument(s) and/or return value have the wrong type. Erroneous code example: ``` #[repr(simd)] -struct i8x16(i8, i8, i8, i8, i8, i8, i8, i8, - i8, i8, i8, i8, i8, i8, i8, i8); -#[repr(simd)] -struct i32x4(i32, i32, i32, i32); +struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); #[repr(simd)] -struct i64x2(i64, i64); +struct i64x8(i64, i64, i64, i64, i64, i64, i64, i64); extern "platform-intrinsic" { - fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2; - // error: intrinsic arguments have wrong length + fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i64x8; + // error: intrinsic argument/return value has wrong type } ``` To fix this error, please refer to the function declaration to give -it the awaited types with the awaited length. Example: +it the awaited types. Example: ``` #[repr(simd)] @@ -3077,7 +3079,34 @@ extern "platform-intrinsic" { fn x86_mm_adds_epi16(x: i16x8, y: i16x8) -> i16x8; // ok! } ``` -"## +"##, + +E0444: r##" +A platform-specific intrinsic function has wrong number of arguments. +Erroneous code example: + +``` +#[repr(simd)] +struct f64x2(f64, f64); + +extern "platform-intrinsic" { + fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; + // error: platform-specific intrinsic has invalid number of arguments +} +``` + +Please refer to the function declaration to see if it corresponds +with yours. Example: + +``` +#[repr(simd)] +struct f64x2(f64, f64); + +extern "platform-intrinsic" { + fn x86_mm_movemask_pd(x: f64x2) -> i32; // ok! +} +``` +"##, } @@ -3163,6 +3192,4 @@ register_diagnostics! { E0439, // invalid `simd_shuffle`, needs length: `{}` E0440, // platform-specific intrinsic has wrong number of type parameters E0441, // unrecognized platform-specific intrinsic function - E0443, // intrinsic {} has wrong type: found `{}`, expected `{}` which - // was used for this vector type previously in this signature } |
