r/rust • u/rustacean1337 • 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
View all comments
Show parent comment
-1
u/[deleted] Nov 19 '22
Why would you keep a ref of the ID somewhere else when it belongs to the user? Isn't that a design error?
If the ID is meant to be mutable, make it public and you're done. I really don't get why you would ever want to keep a reference of a non-public field on a struct, keep it in scope and then borrow the struct mutably for another one of its fields.
Just call
user.id()where you need it. Why keep a reference? It's not mutable anyway.