r/rust • • Nov 17 '22

What are Rust’s biggest weaknesses?

What would you say are Rust’s biggest weaknesses right now? And are they things that can be fixed in future versions do you think or is it something that could only be fixed by introducing a breaking change? Let’s say if you could create a Rust 2.0 and therefore not worry about backwards compatibility what would you do different.

220 Upvotes

390 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Nov 20 '22

To me that's just a code smell. If the field belongs to a struct but you want to use it somewhere else it either shouldn't be in said struct, you should borrow it very temporarily directly from the struct to use in a function or it should be Clone and you should clone it.

Throwing references around implicitly is exactly what Rust tries to prevent. If you still want to do that it should be Rc'd or Arc'd depending.