Skip to content

Commit

Permalink
Add failing tests for #46 (#165)
Browse files Browse the repository at this point in the history
These passed before 02cd324.
  • Loading branch information
LegNeato authored Dec 13, 2024
1 parent c52845f commit d9dba91
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/ui/lang/issue-46.rs
Original file line number Diff line number Diff line change
@@ -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];
}
40 changes: 40 additions & 0 deletions tests/ui/lang/issue-46.stderr
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d9dba91

Please sign in to comment.