I'm not arguing any of these points.
I'm just saying there are these two misconceptions:
- if you write safe rust code, your code can't segfault
This isn't true if your code path contains any unsafe code.
- Rust code can't segfault
This isn't true
at all.
Sure, if it does segfault its a bug in the c code / unsafe code.
You're absolutely correct.
...but bugs aren't deliberate. Obviously no one is going to deliberately expose a c api that has segfaults in it.
The misconception is that if you're using rust you're safe from the bugs that other programmers may have made... which is not true.
There's a trust chain involved; if you depend on a library you trust it's bug free and won't delete your harddisk and crash your program, but there's a difference between trusting a library is not malicious, and trusting a library is bug free.
If you have to trust the library is bug free, you're really no better off than using C++ are you?
...but people keep saying that if you use rust then there are certain types of safety that are guaranteed by the language: http://doc.rust-lang.org/reference.html#behavior-considered-..., regardless of programmer bugs.
It's just not true.
Once again, I'm not arguing that safety is good or bad or whatever. My assertion is very very specific:
Rust code written 100% safely can crash if it has a dependency that uses unsafe code.
The assertion that 100% safely written rust code with arbitrary dependencies can't crash is false.