diff options
| author | gnzlbg <gonzalobg88@gmail.com> | 2019-09-25 13:39:20 +0200 |
|---|---|---|
| committer | gnzlbg <gonzalobg88@gmail.com> | 2019-09-25 13:39:20 +0200 |
| commit | e74a268db511d4f124425c981300ebfaea0d64ee (patch) | |
| tree | 37b376f559838b59fd7b32de1c8f613f61958bfb /src/test | |
| parent | 5976674a717f61167a930df0c1fa1fe4106a439e (diff) | |
Test errors
Diffstat (limited to 'src/test')
13 files changed, 181 insertions, 60 deletions
diff --git a/src/test/ui/consts/const-eval/simd/extract-fail0.rs b/src/test/ui/consts/const-eval/simd/extract-fail0.rs new file mode 100644 index 00000000000..d2c313ddd0c --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/extract-fail0.rs @@ -0,0 +1,22 @@ +// failure-status: 101 +// rustc-env:RUST_BACKTRACE=0 +#![feature(const_fn)] +#![feature(repr_simd)] +#![feature(platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] struct i8x1(i8); + +extern "platform-intrinsic" { + fn simd_extract<T, U>(x: T, idx: u32) -> U; +} + +const X: i8x1 = i8x1(42); + +const fn extract_wrong_ret() -> i16 { + unsafe { simd_extract(X, 0_u32) } +} + +const A: i16 = extract_wrong_ret(); + +fn main() {} diff --git a/src/test/ui/consts/const-eval/simd/extract-fail0.stderr b/src/test/ui/consts/const-eval/simd/extract-fail0.stderr new file mode 100644 index 00000000000..51518481941 --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/extract-fail0.stderr @@ -0,0 +1,15 @@ +thread 'rustc' panicked at 'assertion failed: `(left == right)` + left: `i8`, + right: `i16`: Return type `i16` must match vector element type `i8`', src/librustc_mir/interpret/intrinsics.rs:281:17 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. + +error: internal compiler error: unexpected panic + +note: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports + +note: rustc 1.39.0-dev running on x86_64-apple-darwin + +note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0 + diff --git a/src/test/ui/consts/const-eval/simd/extract-fail1.rs b/src/test/ui/consts/const-eval/simd/extract-fail1.rs new file mode 100644 index 00000000000..ddff608181e --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/extract-fail1.rs @@ -0,0 +1,22 @@ +// failure-status: 101 +// rustc-env:RUST_BACKTRACE=0 +#![feature(const_fn)] +#![feature(repr_simd)] +#![feature(platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] struct i8x1(i8); + +extern "platform-intrinsic" { + fn simd_extract<T, U>(x: T, idx: u32) -> U; +} + +const X: i8x1 = i8x1(42); + +const fn extract_wrong_vec() -> i8 { + unsafe { simd_extract(42_i8, 0_u32) } +} + +const B: i8 = extract_wrong_vec(); + +fn main() {} diff --git a/src/test/ui/consts/const-eval/simd/extract-fail1.stderr b/src/test/ui/consts/const-eval/simd/extract-fail1.stderr new file mode 100644 index 00000000000..a00d98bf7fd --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/extract-fail1.stderr @@ -0,0 +1,15 @@ +error: internal compiler error: src/librustc_mir/interpret/operand.rs:346: Type `i8` is not a SIMD vector type + +thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. + +note: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports + +note: rustc 1.39.0-dev running on x86_64-apple-darwin + +note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0 + +error: aborting due to previous error + diff --git a/src/test/ui/consts/const-eval/simd/extract-fail2.rs b/src/test/ui/consts/const-eval/simd/extract-fail2.rs new file mode 100644 index 00000000000..e2eb449f977 --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/extract-fail2.rs @@ -0,0 +1,22 @@ +// failure-status: 101 +// rustc-env:RUST_BACKTRACE=0 +#![feature(const_fn)] +#![feature(repr_simd)] +#![feature(platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] struct i8x1(i8); + +extern "platform-intrinsic" { + fn simd_extract<T, U>(x: T, idx: u32) -> U; +} + +const X: i8x1 = i8x1(42); + +const fn extract_wrong_idx() -> i8 { + unsafe { simd_extract(X, 1_u32) } +} + +const C: i8 = extract_wrong_idx(); + +fn main() {} diff --git a/src/test/ui/consts/const-eval/simd/extract-fail2.stderr b/src/test/ui/consts/const-eval/simd/extract-fail2.stderr new file mode 100644 index 00000000000..5d74e115ef8 --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/extract-fail2.stderr @@ -0,0 +1,13 @@ +thread 'rustc' panicked at 'index `1` is out-of-bounds of vector type `i8` with length `1`', src/librustc_mir/interpret/intrinsics.rs:276:17 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. + +error: internal compiler error: unexpected panic + +note: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports + +note: rustc 1.39.0-dev running on x86_64-apple-darwin + +note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0 + diff --git a/src/test/ui/consts/const-eval/simd/insert-fail0.rs b/src/test/ui/consts/const-eval/simd/insert-fail0.rs new file mode 100644 index 00000000000..dca58fb2555 --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/insert-fail0.rs @@ -0,0 +1,22 @@ +// failure-status: 101 +// rustc-env:RUST_BACKTRACE=0 +#![feature(const_fn)] +#![feature(repr_simd)] +#![feature(platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] struct i8x1(i8); + +extern "platform-intrinsic" { + fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T; +} + +const X: i8x1 = i8x1(42); + +const fn insert_wrong_scalar() -> i8x1 { + unsafe { simd_insert(X, 0_u32, 42_i16) } +} + +const D: i8x1 = insert_wrong_scalar(); + +fn main() {} diff --git a/src/test/ui/consts/const-eval/simd/insert-fail0.stderr b/src/test/ui/consts/const-eval/simd/insert-fail0.stderr new file mode 100644 index 00000000000..1ea31ec8deb --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/insert-fail0.stderr @@ -0,0 +1,15 @@ +thread 'rustc' panicked at 'assertion failed: `(left == right)` + left: `i16`, + right: `i8`: Scalar type `i16` must match vector element type `i8`', src/librustc_mir/interpret/intrinsics.rs:257:17 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. + +error: internal compiler error: unexpected panic + +note: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports + +note: rustc 1.39.0-dev running on x86_64-apple-darwin + +note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0 + diff --git a/src/test/ui/consts/const-eval/simd/insert-fail1.rs b/src/test/ui/consts/const-eval/simd/insert-fail1.rs new file mode 100644 index 00000000000..2a3d79b76c3 --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/insert-fail1.rs @@ -0,0 +1,22 @@ +// failure-status: 101 +// rustc-env:RUST_BACKTRACE=0 +#![feature(const_fn)] +#![feature(repr_simd)] +#![feature(platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] struct i8x1(i8); + +extern "platform-intrinsic" { + fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T; +} + +const X: i8x1 = i8x1(42); + +const fn insert_wrong_idx() -> i8x1 { + unsafe { simd_insert(X, 1_u32, 42_i8) } +} + +const E: i8x1 = insert_wrong_idx(); + +fn main() {} diff --git a/src/test/ui/consts/const-eval/simd/insert-fail1.stderr b/src/test/ui/consts/const-eval/simd/insert-fail1.stderr new file mode 100644 index 00000000000..38d37822630 --- /dev/null +++ b/src/test/ui/consts/const-eval/simd/insert-fail1.stderr @@ -0,0 +1,13 @@ +thread 'rustc' panicked at 'Index `1` must be in bounds of vector type `i8`: `[0, 1)`', src/librustc_mir/interpret/intrinsics.rs:247:17 +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace. + +error: internal compiler error: unexpected panic + +note: the compiler unexpectedly panicked. this is a bug. + +note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports + +note: rustc 1.39.0-dev running on x86_64-apple-darwin + +note: compiler flags: -Z threads=1 -Z ui-testing -Z unstable-options -C prefer-dynamic -C rpath -C debuginfo=0 + diff --git a/src/test/ui/consts/const-eval/simd/insert_extract-fail.rs b/src/test/ui/consts/const-eval/simd/insert_extract-fail.rs deleted file mode 100644 index 1d1df8d25a4..00000000000 --- a/src/test/ui/consts/const-eval/simd/insert_extract-fail.rs +++ /dev/null @@ -1,27 +0,0 @@ -#![feature(const_fn)] -#![feature(repr_simd)] -#![feature(platform_intrinsics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] struct i8x1(i8); - -extern "platform-intrinsic" { - fn simd_insert<T, U>(x: T, idx: u32, val: U) -> T; - fn simd_extract<T, U>(x: T, idx: u32) -> U; -} - -const fn foo(x: i8x1) -> i8 { - // 42 is a i16 that does not fit in a i8 - unsafe { simd_insert(x, 0_u32, 42_i16) }.0 //~ ERROR -} - -const fn bar(x: i8x1) -> i16 { - // the i8 is not a i16: - unsafe { simd_extract(x, 0_u32) } //~ ERROR -} - -fn main() { - const V: i8x1 = i8x1(13); - const X: i8 = foo(V); - const Y: i16 = bar(V); -} diff --git a/src/test/ui/consts/const-eval/simd/insert_extract-fail.stderr b/src/test/ui/consts/const-eval/simd/insert_extract-fail.stderr deleted file mode 100644 index cf4e6887f16..00000000000 --- a/src/test/ui/consts/const-eval/simd/insert_extract-fail.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error: any use of this value will cause an error - --> $DIR/insert_extract-fail.rs:14:14 - | -LL | unsafe { simd_insert(x, 0_u32, 42_i16) }.0 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | Inserting `i16` with size `2` to a vector element place of size `1` - | inside call to `foo` at $DIR/insert_extract-fail.rs:19:19 -... -LL | const X: i8 = foo(V); - | --------------------- - | - = note: `#[deny(const_err)]` on by default - -error: aborting due to previous error - diff --git a/src/test/ui/consts/const-eval/simd/read_fail.rs b/src/test/ui/consts/const-eval/simd/read_fail.rs deleted file mode 100644 index c5109c16e4c..00000000000 --- a/src/test/ui/consts/const-eval/simd/read_fail.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(const_fn)] -#![feature(platform_intrinsics)] -#![allow(non_camel_case_types)] - -extern "platform-intrinsic" { - fn simd_extract<T, U>(x: T, idx: u32) -> U; -} - -const fn foo(x: i8) -> i8 { - // i8 is not a vector type: - unsafe { simd_extract(x, 0_u32) } //~ ERROR -} - -fn main() { - const V: i8 = 13; - const X: i8 = foo(V); -} |
