4 ms·
Maybe my understanding of one or more concepts involves is wrong, but that "more segfaults" bit confuses me. Shouldn't the rust compiler prevent code that can s
by nisegami 1y ago
Maybe my understanding of one or more concepts involves is wrong, but that "more segfaults" bit confuses me. Shouldn't the rust compiler prevent code that can segfault from compiling? Unless there was a lot of unsafe blocks involved.
Edit: apparently it did turn out to be a lot of unsafe code
- miroljub 1y agoMy understanding is that, even though tmux-rs is written in a safer language, it still can't beat the stability of an old battle-tested well-maintained project written by a group of highly competent developers. Every new project is bound to have bugs that need to be ironed out during the time.
- Ar-Curunir 1y agoIt’s just because there are a lot of unsafes, and because the translation from C to Rust introduced semantic-mismatch bugs
- a_humean 1y agoThey wrote everything in unsafe rust where its very possible to segfault. This is not a normal C to Rust port. In a normal port you would never aim to have 100% unsafe rust code - rather you would hive off small parts of your application where you need unsafe so its highlighted and auditable. This is clearly an excerise for fun.
- nicoburns 1y agoI think it is a normal porting process, it's just only half-finished at this point. The conversion to safe Rust is yet to come.
- antonvs 1y agoNo, the issue is that doing a direct translation from a fundamentally unsafe language like C can't fix safety issues. You'd have to do a proper rewrite, in which case you could write safe code from the start. > Every new project is bound to have bugs that need to be ironed out during the time. Not on the level of the kind of critical security and reliability bugs that unsafe languages foster. That's why CISA and the FBI both strongly recommend memory-safe languages.
- QuaternionsBhop 1y agoMy understanding is that the author was referring to there being more segfaults in programming than in gardening.
- nicce 1y agoBoth can be true at the same time in that sentence
- Jtsummers 1y agoIt's a transliteration. He's basically implemented a C program in Rust. He says in the conclusion the next goal is converting it to safe Rust.
- ar_lan 1y agoIn the second sentence he mentions: > the code base is now 100% (unsafe) Rust I didn't interpret that it's 100% unsafe, but I do expect that to mean there is probably a lot of unsafe blocks used. A good amount of the example code in the post alone is unsafe blocks as well.