I think the answer to your question is also the answer to the question of how Zig achieves memory safety at compile time.
Yeah, Rust is C with a sane version of C++'s RAI, Zig is C with a sane version of C++'s templates. Having Turing complete duck typed template metaprogramming is very fun and useful, but I understand why you wouldn't want that in huge security critical codebases.