Closed
Description
Code
fn main() {
let a: [u8; 3] = [1,2,3];
let b = &a;
let c = b as *const [u32; 3];
}
Current output
error[E0308]: mismatched types
--> src/main.rs:4:13
|
4 | let c = b as *const [u32; 3];
| ^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `[u32; 3]`
Desired output
error[E0308]: mismatched types
--> src/main.rs:4:13
|
4 | let c = b as *const [u32; 3];
| ^^^^^^^^^^^^^^^^^^^^ expected `[u8; 3]`, found `[u32; 3]`
// Alternatively: expected `u8`, found `u32`
Rationale and extra context
Current error message seems to suggest I am trying to convert a &u8
to *const [u32; 3]
when I am actually trying to convert a &[u8; 3]
.
Other cases
Rust Version
1.87.0-nightly
(2025-03-21 be73c1f4617c97bce81b)
Anything else?
No response