> this doesn't automatically prevent the code from containing CVE, does it?
There are certainly tools to detect any known CVEs, and tools to help you audit the unsafe code that you are using. They don't provide rigorous proofs automatically of course, the same way the standard library is generally not rigorously proved to be correct.
> But when you enter a territory of OS kernels,
Nothing really changes, see redox as an example of a fairly "complete" kernel written in rust with a reasonably low amount of unsafe.
> we want them to be implemented as efficiently as C is capable of,
This is already the case with Rust's typical library system. Generic libraries in rust are not less efficient.
In the real world rust datastructures are typically more efficient in my experience because the clean separation makes it easy to optimize the hell out of them.
> What about dependent types
That's a tool not a problem - you have yet to provide an argument that they are necessary and real world experience says that Rust achieves a meaningful amount of safety and convenience without them.
> totality checking
That's also a tool not a problem, and you could argue that rust's ADTs (enums) give you a weak version of it.