| Sibling doesn't really cover the benefits vs. Go, so here's my attempt at a list. * Rust offers memory safety without a GC. You may or may not want a GC. If you don't, then Rust is the better option. * More broadly, Rust has a C++-like focus on providing zero cost abstractions. Go is generally happy to accept a small runtime cost for abstraction. * Rust can generate small WASM targets because it doesn't need to bundle a runtime. Go can target WASM too, but you either need to accept much larger object sizes or use TinyGo, which doesn't implement all Go language features (although it's pretty close now that generics support has arrived). * Rust code generally runs faster (although a lot depends on whether you're writing the kind of code where a GC is a net positive or a net negative for performance). * Rust has a fancier type system that's much more able to express invariants. If your happy place is a place where the type system proves that your code is correct, then Rust will make you much happier than Go. The Go type system (and the culture around Go more generally) tends not to favor elaborate abstractions built on types. * Rust has fully-featured macros, if that's your bag. I think there are also some disadvantages of Rust compared to Go, but I've only attempted to list the advantages here. |
- No more bugs where a value that shouldn't be mutated is accidentally mutated in another place.
- No more bugs with writing to a closed channel or file.
- No more bugs with forgetting to close a file.
- No more null pointer errors at runtime.
- No more runtime reflection errors.
Compared to Go, safe Rust provides all these benefits and more.