Why not?
Why not?
Posted Nov 21, 2025 14:17 UTC (Fri) by gmatht (guest, #58961)In reply to: MISRA C is not provably safe. by tialaramex
Parent article: Rust in Android: move fast and fix things (Google Security Blog)
Writing a general borrow checker for C is hard because C lacks the lifetime annotations and valid standards compliant C code may not conform to the borrow checkers expectations.
However MISRA-C is much more pedantic than the Rust borrow-checker. Since dynamic allocations are banned, unless all lifetimes are static, the program is not valid MISRA-C. And if all lifetimes are static, lifetime annotations are redundant, and lifetime checks are redundant.
There are lots of edge cases to consider, for example, if race conditions could result in memory unsafety. However, it seems that if a compiler is allowed to reject non-MISRA-C this would make it vastly easier to only accept provably safe programs.
