Rust in an Instant
fnordig.de
fnordig.de
[1]: https://devblogs.microsoft.com/oldnewthing/20060508-22/?p=31...
[0]: chosen by fair dice roll
It would be nice if these programs failed to link however.
The TL;DR is that safe Rust is only sound, if the safe APIs it uses are sound, which requires their implementations to be sound (Derek Dreyer et al. [0]). That is, the soundness proofs a Rust's compiler gives you only apply to Rust programs with sound unsafe code.
If you exchange the malloc implementation with an unsound one, then the soundness proofs the compiler provides just don't apply to your program anymore (they apply only to programs with a sound malloc implementation).
---
Being able to worry about soundness in this space is kind of a luxus problem, but probably still one the most interesting aspect of Rust. Like, with C or C++, there is little discussion about soundness because most of the language is already unsound. Like, not even MISRA C tries to make a subset of C sound, just "less dangerous" or "less likely to make mistakes".
The big deal of Rust is that it modularizes soundness proofs, allowing users to prove different modules of their program "conditionally sound", e.g., sound _if_ everything they use is also sound. Most Rust code on crates.io is close to 100% safe Rust code, and that code is already "conditionally sound". This means that you only need to manually prove the remaining 1% of the unsafe Rust code correct, which is a much more tractable problem, than trying to prove 100% of the code correct.
This allows people to refactor that 1% of the code into tiny modules, that each can be proven correct in isolation, and that allow changes to be more precisely scrutinized.
The impact of this is huge. You can refactor pretty much all code you write without worrying about soundness, only needing to worry about it if you need to change one of those tiny modules.
"Rust is safe" means something like, if you write code to do a thing, it doesn't unintentionally lead to memory corruption. Opening /proc/self/mem is being fairly intentional about it. Colliding with a C function in another library could be unintentional, which is why I opened that, but most of the time (as with the blog post) it's fairly deliberate and obvious.
He took his time to write down something, because some beginners asked him on Twitter.
Someone posts it on Hacker News and you shit over it like this.
If the post is too mundane for you, so be it. You're not the audience.
[1] https://drewdevault.com/2016/07/19/Using-Wl-wrap-for-mocking...
Rust is not the only thing I come here for.