4 ms·
Writing rust since ~2016, doing a lot of async/await and multithreaded stuff and using explicit lifetimes quite often. At the beginning it was a case of write
by _-___________-_ 7y ago
Writing rust since ~2016, doing a lot of async/await and multithreaded stuff and using explicit lifetimes quite often.
At the beginning it was a case of write the code, then see how the borrow checker complains and fix it. Now that I understand the semantics intuitively, for the last year or so, it's very rare for the compiler to complain about anything. I guess I've internalised the semantics -- they're not exactly arbitrary, mostly the lifetime rules just follow from what you should be doing anyway.
One thing I would encourage (and this applies in general) is trying to understand _why_ the compiler is complaining about some code you wrote before attempting to "make the error go away". Don't just hammer away until you make it work; that's not how you learn. I've seen a lot of Rust code that's full of unnecessary use of Cell, Rc, etc because people didn't take the time to understand the semantics and just reached for ways to "make the errors go away".