From 4a53b8a01343870f74c17d9f224e34895c153dbb Mon Sep 17 00:00:00 2001 From: Christian Legnitto Date: Sun, 1 Dec 2024 16:37:06 -0400 Subject: [PATCH] Add failing tests for https://github.com/Rust-GPU/rust-gpu/issues/46 These passed before https://github.com/Rust-GPU/rust-gpu/commit/02cd3248ad13df8e0b4fa2962ceb57ac089e2d49. --- tests/ui/lang/issue-46.rs | 15 +++++++++++++ tests/ui/lang/issue-46.stderr | 40 +++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 tests/ui/lang/issue-46.rs create mode 100644 tests/ui/lang/issue-46.stderr diff --git a/tests/ui/lang/issue-46.rs b/tests/ui/lang/issue-46.rs new file mode 100644 index 0000000000..ca7be62dd6 --- /dev/null +++ b/tests/ui/lang/issue-46.rs @@ -0,0 +1,15 @@ +// build-fail + +use spirv_std::spirv; + +#[derive(Default)] +struct Foo { + bar: bool, + baz: [[u32; 2]; 1], +} + +#[spirv(fragment)] +pub fn main() { + let x = [[1; 2]; 1]; + let y = [Foo::default(); 1]; +} diff --git a/tests/ui/lang/issue-46.stderr b/tests/ui/lang/issue-46.stderr new file mode 100644 index 0000000000..1e8c8b8c8c --- /dev/null +++ b/tests/ui/lang/issue-46.stderr @@ -0,0 +1,40 @@ +error: cannot cast between pointer types + from `*i32` + to `*[i32; 2]` + --> $DIR/issue-46.rs:13:13 + | +13 | let x = [[1; 2]; 1]; + | ^^^^^^^^^^^ + | +note: used from within `issue_46::main` + --> $DIR/issue-46.rs:13:13 + | +13 | let x = [[1; 2]; 1]; + | ^^^^^^^^^^^ +note: called by `main` + --> $DIR/issue-46.rs:12:8 + | +12 | pub fn main() { + | ^^^^ + +error: cannot cast between pointer types + from `*[[u32; 2]; 1]` + to `*struct Foo { baz: [[u32; 2]; 1], bar: bool }` + --> $DIR/issue-46.rs:14:13 + | +14 | let y = [Foo::default(); 1]; + | ^^^^^^^^^^^^^^^^^^^ + | +note: used from within `issue_46::main` + --> $DIR/issue-46.rs:14:13 + | +14 | let y = [Foo::default(); 1]; + | ^^^^^^^^^^^^^^^^^^^ +note: called by `main` + --> $DIR/issue-46.rs:12:8 + | +12 | pub fn main() { + | ^^^^ + +error: aborting due to 2 previous errors +