Skip to content
/ rust Public
forked from rust-lang/rust

Commit 8962536

Browse files
committed
Add ui test cast-array-issue-138836
Signed-off-by: xizheyin <[email protected]>
1 parent ae8ab87 commit 8962536

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Diff for: tests/ui/cast/cast-array-issue-138836.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
let a: [u8; 3] = [1,2,3];
3+
let b = &a;
4+
let c = b as *const [u32; 3]; //~ ERROR mismatched types [E0308]
5+
}

Diff for: tests/ui/cast/cast-array-issue-138836.stderr

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/cast-array-issue-138836.rs:4:13
3+
|
4+
LL | let c = b as *const [u32; 3];
5+
| ^^^^^^^^^^^^^^^^^^^^ expected `[u8; 3]`, found `[u32; 3]`
6+
|
7+
= note: expected array `[u8; 3]`
8+
found array `[u32; 3]`
9+
10+
error: aborting due to 1 previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)