Add ui test cast-array-issue-138836
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
This commit is contained in:
parent
ae8ab87de4
commit
89625360ec
2 changed files with 17 additions and 0 deletions
5
tests/ui/cast/cast-array-issue-138836.rs
Normal file
5
tests/ui/cast/cast-array-issue-138836.rs
Normal 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]
|
||||
}
|
||||
12
tests/ui/cast/cast-array-issue-138836.stderr
Normal file
12
tests/ui/cast/cast-array-issue-138836.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue