In Rust, the transmute function is used to reinterpret the bits of a value of one type as another type. Hence, both types must have the same size.
Compilation will fail if this is not guaranteed. Transmute is semantically equivalent to a bitwise move of one type into another. It copies the bits from the source value into the destination value.
As tuples don't have a fixed layout, transmuting from a tuple type to array or slice is considered undefined behaviour.
Consider using pattern matching.
fn foo() {
let zeroed_array: [u64; 2] = unsafe { std::mem::transmute((0u64, 0u64)) };
}
fn foo() {
let zeroed_array: [u64; 2] = match (0u64, 0u64) {
(x, y) => [x, y]
};
}