3 ms·
There are already a lot of cases where LLVM can successfully optimize away things like safe Rust's bounds checks in loops. There are also efforts to include "c
by dikaiosune 9y ago
There are already a lot of cases where LLVM can successfully optimize away things like safe Rust's bounds checks in loops.
There are also efforts to include "const generics" which will let you use e.g. array lengths as generics that may be able to teach LLVM new optimizations. Maybe someday in the far future that will grow into some kind of dependent typing extension for Rust? That could potentially allow for safe, bounds-check free array access that would currently require unsafe. But I don't know if that would allow for proving the kinds of things this article discusses.
Ultimately though, the unsafe subset is pretty small and is generally in my experience only interesting when building heavily reused abstractions (the kinds of lock-free algorithms OP discusses for example). It'll be really cool if these efforts expose some ways to shrink reliance on unsafe code, but I'm personally not sweating it.