Skip to content

Commit a63ca25

Browse files
committed
Add failing tests for Rust-GPU#46
These passed before Rust-GPU@02cd324.
1 parent d3f9af7 commit a63ca25

4 files changed

+64
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// build-fail
2+
3+
use spirv_std::spirv;
4+
5+
#[spirv(fragment)]
6+
pub fn main() {
7+
let x = [[1; 2]; 1];
8+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error: cannot cast between pointer types
2+
from `*i32`
3+
to `*[i32; 2]`
4+
--> $DIR/allocate_default_array_of_array.rs:7:13
5+
|
6+
7 | let x = [[1; 2]; 1];
7+
| ^^^^^^^^^^^
8+
|
9+
note: used from within `allocate_default_array_of_array::main`
10+
--> $DIR/allocate_default_array_of_array.rs:7:13
11+
|
12+
7 | let x = [[1; 2]; 1];
13+
| ^^^^^^^^^^^
14+
note: called by `main`
15+
--> $DIR/allocate_default_array_of_array.rs:6:8
16+
|
17+
6 | pub fn main() {
18+
| ^^^^
19+
20+
error: aborting due to 1 previous error
21+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// build-fail
2+
3+
use spirv_std::spirv;
4+
5+
#[derive(Default)]
6+
struct Foo {
7+
bar: bool,
8+
baz: [[u32; 2]; 1],
9+
}
10+
11+
#[spirv(fragment)]
12+
pub fn main() {
13+
let x = [Foo::default(); 1];
14+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error: cannot cast between pointer types
2+
from `*[[u32; 2]; 1]`
3+
to `*struct Foo { baz: [[u32; 2]; 1], bar: bool }`
4+
--> $DIR/allocate_default_array_of_array_in_struct.rs:13:13
5+
|
6+
13 | let x = [Foo::default(); 1];
7+
| ^^^^^^^^^^^^^^^^^^^
8+
|
9+
note: used from within `allocate_default_array_of_array_in_struct::main`
10+
--> $DIR/allocate_default_array_of_array_in_struct.rs:13:13
11+
|
12+
13 | let x = [Foo::default(); 1];
13+
| ^^^^^^^^^^^^^^^^^^^
14+
note: called by `main`
15+
--> $DIR/allocate_default_array_of_array_in_struct.rs:12:8
16+
|
17+
12 | pub fn main() {
18+
| ^^^^
19+
20+
error: aborting due to 1 previous error
21+

0 commit comments

Comments
 (0)