As @chris-morgan kindly pointed out on StackOverflow, std::mem::size_of()
cannot currently be used as a constant expression. size_of::<T>()
appears to be evaluated at runtime, which artificially limits the construct in my opinion.
I went searching for historical background and only managed to dig up a mailing list thread from 2012, which punts the issue as a nice to have.
I’m unsure how to proceed at this point. Would an RFC be the logical next step? Does compile time sizeof jive with Rust philosophy?