I mean, compiler bugs... exist. They are not particularly easy to hit and especially hard to exploit though.
Many type systems also have unsoundness bugs, you just have to write the code in a very special unnatural way, so they don't really ever come up in real code.
I believe this borrow checker one was the same case.
(And Im no rust fanboy, see my other comments where I'm sarcastically say that rust just never got popular enough to have this kind of vuln)
You are right and I was more poking fun than anything. It was just relevant in my mind because I'd just watched the LetsGetRusty YouTube video of it. This one was extremely obscure and requires a custom impl of a trait that is auto generated for you.
I think that compilers have very few bugs compared to their complexity level and the developers that write them do phenomenal work.
Which is why i cant wrap my head around the people defending PHP.
Its not about Rust being perfect. Its about any big exploit the Rust community the rust-focused social media channels would be filled with analysis on how the safety features failed.
All i'm seeing from PHP is deflection about how other langs also sometimes get exploited. Sorry but that logic is bad and overlooking the important bits: how PHP can't properly secure their 1 big blob of unsafe C that parses every HTTP request, and is unwilling to talk about it or how their average dev doesn't seem to realize how far behind mainstream security practices they are.
Don't forget about the double reference lifetime bug that is still open after a decade.
That being said "the compiler might not catch a possible segfault if you write absolutely horrendous spaghetti" is not exactly on the same level as "actively exploited RCE because you didn't correctly free a buffer and use global state for request data in a webserver."
... idk, by next year the rust compiler will fix the already obscure bug, but the C++ UB will remain UB. As someone that pays his bills with C++, I don't see it as a win.
Agreed. I like C++. I may even prefer it to Rust. I think the committee made a bad decision when they discontinued P3390. Sean Baxter was on the right track and profiles don't seem to solve the crux of the problem once you get away from simple examples.
UB means undefined behavior. In safe Rust the borrow checker guarantees there is no UB. Or at least that's the idea. It rejects some technically valid code in favor of guaranteeing that a sub set of complex code is safe.
A simple example is array like collection access. If you use [] in C++ to access out of bounds of a collection, you have UB. If you access out of bounds you could get garbage data or you might get a segfault. The compiler might assume the pointer the array access decays to is valid and make optimization decisions based on that because the compiler always assumes the programmer has not written UB code.
In safe Rust all array access is bounds checked. The compiler and the array safe api guarantees that you only access within bounds, always. It is not possible in safe Rust to write UB code using any of the array like collections.
View all comments
Show parent comment
44
u/Usual_Office_1740 Oct 22 '26 edited Oct 22 '26
Don't look at the 11 year old high priority borrow checker error that came out today that allows for UB in safe Rust.
I saw your /s and thought it was funny. My response is real.
Edit: I learned about it today. Someone else pointed out that it might be older.