Hello, I was wondering why the following would not be correctly checked as valid. I'm about a few months into my Rust journey, of which I had many challenges regarding arrays in general, but this one seems to be a compiler "issue".
/// Upon asking this question, I realized this was not random, but question still remains.
fn make_random<const R : usize, const C : usize>() -> ArrayStorage<f32, R, C> {
unsafe { return transmute([[fastrand::f32(); R]; C]); }
}
cannot transmute between types of different sizes, or dependently-sized types [E0512]
Note: source type:[[f32; R]; C]
(this type does not have a fixed size)
Note: target type:nalgebra::ArrayStorage<f32, R, C>
(size can vary because of [[f32; R]; C])
/// An array-based statically sized matrix data storage.
#[repr(transparent)]
/// Some more annotations
pub struct ArrayStorage<T, const R: usize, const C: usize>(pub [[T; R]; C]);
Why would the size vary when it can be checked at compile time and is effectively identical?