Hacker News new | ask | show | jobs
by lionkor 488 days ago
I rarely if ever have to worry about the borrow checker, mostly stumbling blocks are move/copy/clone semantics.

GitHub Copilot does a good job of generating correct Rust, it just has the usual subtle-but-annihilating-if-not-caught logic bugs, like in all other languages.

2 comments

> rarely if ever have to worry about the borrow checker mostly stumbling blocks are move/copy/clone semantics

I'm don't write Rust for a living, only been experimenting on-and-off with the language, but isn't stumbling on the move/copy/clone semantics literally stumbling on the borrow checker? Or are there issues regarding move/copy/clone that aren't related to the the borrow checker?

The borrow checker handles references, the fact that everything is move-by-default when it's usually copy-by-defaut (C, C++) or reference-by-default (Java, C#), that's not really a borrow checker feature. Move and copy semantics exist in C++, too, but the defaults are different.
In my experience, Copilot is not able to fix rust code flagged by the borrow checker. Its suggestions are almost always wrong.This is a hard problem and often requires restructing the code (and sometimes using inner mutuability constructs such as RefCell and so on).