Skip to content

Commit

Permalink
Add failing tests for #46
Browse files Browse the repository at this point in the history
These passed before 02cd324.
  • Loading branch information
LegNeato committed Dec 1, 2024
1 parent d3f9af7 commit a63ca25
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/ui/lang/core/ptr/allocate_default_array_of_array.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// build-fail

use spirv_std::spirv;

#[spirv(fragment)]
pub fn main() {
let x = [[1; 2]; 1];
}
21 changes: 21 additions & 0 deletions tests/ui/lang/core/ptr/allocate_default_array_of_array.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error: cannot cast between pointer types
from `*i32`
to `*[i32; 2]`
--> $DIR/allocate_default_array_of_array.rs:7:13
|
7 | let x = [[1; 2]; 1];
| ^^^^^^^^^^^
|
note: used from within `allocate_default_array_of_array::main`
--> $DIR/allocate_default_array_of_array.rs:7:13
|
7 | let x = [[1; 2]; 1];
| ^^^^^^^^^^^
note: called by `main`
--> $DIR/allocate_default_array_of_array.rs:6:8
|
6 | pub fn main() {
| ^^^^

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// build-fail

use spirv_std::spirv;

#[derive(Default)]
struct Foo {
bar: bool,
baz: [[u32; 2]; 1],
}

#[spirv(fragment)]
pub fn main() {
let x = [Foo::default(); 1];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
error: cannot cast between pointer types
from `*[[u32; 2]; 1]`
to `*struct Foo { baz: [[u32; 2]; 1], bar: bool }`
--> $DIR/allocate_default_array_of_array_in_struct.rs:13:13
|
13 | let x = [Foo::default(); 1];
| ^^^^^^^^^^^^^^^^^^^
|
note: used from within `allocate_default_array_of_array_in_struct::main`
--> $DIR/allocate_default_array_of_array_in_struct.rs:13:13
|
13 | let x = [Foo::default(); 1];
| ^^^^^^^^^^^^^^^^^^^
note: called by `main`
--> $DIR/allocate_default_array_of_array_in_struct.rs:12:8
|
12 | pub fn main() {
| ^^^^

error: aborting due to 1 previous error

0 comments on commit a63ca25

Please sign in to comment.