Closed
Description
I tried transmuting an array of [T; 10] to itself, but rustc gives an error.
fn transmute_to_self<T: Sized>(v: [T; 10]) -> [T; 10] {
unsafe { core::mem::transmute(v) }
}
Error:
error[E0512]: cannot transmute between types of different sizes, or dependently-sized types
--> src/lib.rs:4:14
|
4 | unsafe { transmute(v) }
| ^^^^^^^^^
|
= note: `[T; 10]` does not have a fixed size
Meta
rustc --version --verbose
:
rustc 1.51.0-nightly (e22670468 2020-12-30)
binary: rustc
commit-hash: e2267046859c9ceb932abc983561d53a117089f6
commit-date: 2020-12-30
host: x86_64-pc-windows-msvc
release: 1.51.0-nightly