AI is not good at writing Rust. The ways in which it is bad vary from writing code that just looks off to actually not working. I do not use unsafe frequently so cannot comment on this particular scenario but I have seen similar stuff often, most Rust code that I read from AIs has at least one or two issues.
In particular, if you have a situation that requires any kind of conceptual understanding then AI will likely have issues. Sync blocking async is the classic example. My theory is that humans make this worse because they will often prompt in a certain direction and AI will faithfully build the footgun.
I haven't experienced these issues with latest models writing performant and correct rust fwiw. It does seem to understand Rust's safety concepts quite well when working on reviewing or writing code
No, the distinction with Rust is obvious from the comments on this post by people who have actually used Rust...but the features of the language are such that you need to have some deeper conceptual understanding to use those features effectively. Cpp is the same. Opus writes Rust like someone coming from Python, it is very obvious if you have a lot of hours in the lab...most people do not.
I suspect "Rust is fast/low memory utilization" is the more common value proposition, with memory safety as the bonus that can push it over other fast languages.
Zig is every bit as fast with typically even lower memory footprint as Rust. The main thing Rust promises that Zig cannot already do natively is memory safety. This is not about Python vs Rust. It is one systems language vs another.
Notably the rewrite managed to also both reduce binary size and reduce compile time. Given it's largely a straight non idiomatic migration, that's surprising to me.
I would imagine that the strong type system would also help steer AIs to ensure that code is written correctly. The compiler supplies backpressure to the agent that steers it toward a more correct program.
Isn't the whole point of AI companies using Rust that it's explicit, safe, and AIs are fairly good at writing it?