I have never done anything in Rust. Are there any benefits? Any drawbacks?
One way you can think of it is this:
- Rust rejects some programs that are truly wrong (`“2” + 3` style)
- Rust rejects some programs that really are just fine. They are actively improving this with stuff like “Non-lexical lifetimes.”
- Rust rejects some programs that are fine _how they are now_, but which are hard to keep fine when you change them. This is part of why linked lists are hard to write in Rust :-)
For example, in lexical lifetimes, this fails:
let x = &mut foo;
if x.bar() {
baz()
} else {
foo.consume() // takes foo by value
}
It will complain that you’ve used `foo` while it is borrowed by `x`, even though a human can easily tell that `x` is already irrelevant by that point. NLL would accept this (I believe).It explains the concepts and strengths of Rust in a very easy-to-understand way. (Jim Blandy is also the Author of the O'Reilly Rust book.)