I've been at this for 2 months now and every day it's a struggle. Just this morning I was questioning my sanity and thinking it's not much better than learning C++.
Should I give up? What's your time threshold for learning a new language?
Incidentally, in order to write a good C++ program it is necessary that you follow pretty much the same rules that the borrow checker enforces. The difference is that in Rust the compiler tells you when you fail to do this, while in C++ your program just crashes, or corrupts some data, or has race conditions. You could feel like you’re making a lot of progress in C++, only to end up with a program that is a buggy unstable mess.
The alternatives are to either face the pain up–front, or to use a language with garbage collection. For most tasks, garbage–collected languages are actually the superior solution. This is because the time we spend writing a program has a cost, and that cost is frequently greater than the extra cpu cycles spent scanning the heap or waiting for locks.
I've been programming with C++ and C# professionally for more than 15 years, and have also dabbled with D, pure C, Haskell, Java, Javascript, and a bunch of other languages. I don't consider myself to be very "smart", though, whatever that means. I'm pretty average.
I think that if it's a struggle for you then it's best to give up now, and perhaps return to it later. Don't force yourself if it feels unpleasant.
What should you learn? That would depend a lot on your background, I guess. I would suggest either Haskell or Elm, or one of the lisp-like (clojure) . They are difficult (very difficult, in the case of Haskell) but I felt they were more consistent in their approach than Rust.
FWIW I gave it about 5 months before deciding it's not worth the pain. I had plans to introduce it at my workplace but gave that up.
In the case of Haskell, it took me about 3 years in which I read several books and did a lot of exercises. It wasn't a joy, but I learned a lot, and felt it made me a better programmer. Rust – not so much.
Could you share the parts you found difficult?
My own difficulties were:
* I like functional programming "in the small", but trying to do it in Rust, with closures, I would routinely get error messages which drove me crazy. Each such error message would take me several hours to unravel, since very often the error was in another place in the code entirely. With C++ I often find the problem very quickly, even when using templates and meta-programming, but with Rust it has been a pain. It has made me feel stupid.
* Trying to refactor functions into smaller functions often led to frustrations due to borrowing errors. Things of which I was 100% sure were correct, but couldn't prove it to the compiler. Using "unsafe" felt like cheating. This felt like the worst parts of C++, trying to figure out a smart way to write some templates and getting frustrated by reams of long error messages, and in Rust those error even felt slightly condescending, offering me advice in a friendly tone, that didn't help me since the issue was deeper. With C++, the solution to problems, when I found it at last, always made sense after looking at it for a while. With Rust, I always gave up, read the forums, and ran into some weird borrowing nomenclature that only half made sense. I never felt I grew as a programmer after understanding the error, only that I've understood better some dark corner in the Rust language itself. It has made me feel stupid. I should add that in C++ (and in C#) I always have a clear mental model of the data flow in my app, each object has a clear owner etc., and I have never (to my knowledge) have had any memory leaks.
* Trying to fight the borrow checker by using Arc or Rc caused the code to become very ugly very fast. And I'm someone who is somewhat comfortable reading complex C++ templates, and have even written some myself in my own code. It's just that in Rust you tend to repeat the <> characters a lot more than in C++.
* I found the dot operator being used for all sorts of "member" accesses to be very confusing. I very much like the explicitness in C++ (dot versus * and ->), and on the other hand the clean separation in C# between classes (gc, on the heap) and structs (non-gc, on the stack or inside their container). The dot operator in Rust being used for everything obscured this for me. I like to have a mental model of the data structure as I read through a codebase, and felt that Rust's choice has severely hindered this .
These are all very personal takes, and are obviously colored by my own past experience with other languages at work and during my degree. Also, I must say I tried learning Rust 3-4 years ago, and some things have changed for the better. I still follow Rust postings here on HN. The new edition looks very promising on several fronts, and I might try it again.
This is just my personal opinion, though. Obviously many other people find no issues with Rust and think it's an excellent language.