Add ui test cast-array-issue-138836

Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
xizheyin 2025-03-26 11:27:52 +08:00
parent ae8ab87de4
commit 89625360ec
No known key found for this signature in database
GPG key ID: 0A0D90BE99CEDEAD
2 changed files with 17 additions and 0 deletions

View file

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

View file

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