Rust code is the ultimate evidence of the principal inability for a probability-based generating algorithm (based on sampling from a “learned” probability distribution over “tokens”) to come up with something that passes the type checker, but for the most trivial cases.
The “causality” is that generation of the complex syntactic forms without the actual, proper understanding principles and heuristics is, well, “problematic”.
The running example is these were subtle “already borrowed” panics, where the issue in with the underlying semantics, and the syntax is “correct”. The problem is that a recursive function has to drop all the borrows before a recursive call, and this constraint cannot be expressed in the syntax unless by redundant bindings which will automatically be drooped at the end of the scope.
This kind of understanding and reasoning at more than one level (the syntax and the underlying semantics) is, in principle, impossible for any LLM (this is simply an actual fact). This implies that most of the code, aside from very basic and idiomatic Python (that allows a lot of sloppiness, which is why it is so popular) will always have such kind of subtle bugs that only a real pro could resolve.
One more time, any LLM, no mater how hyped and shilled, works on the level of tokens of syntax and is completely oblivious, in principle, by design, if you will, to any underlying semantics. It appears (only) that it captures the semantics by generating seemingly coherent syntax, but his is exactly what the word “illusion” means – do look it up in the dictionary.
I imagine with C++ the situation is much worse, since the whole “The C++ Guidelines”, hundreds pages long, has been written about how to avoid possible issues in the code which a compiler will happily accept without even issuing a warning.
So, enjoy your “vibe-coding”, retards.