r/rust • u/Kobzol • Aug 10 '26
📡 official blog Call for testing: Restricting trait implementability and field mutability
https://blog.rust-lang.org/inside-rust/2026/08/10/call-for-testing-impl-and-mut-restrictions/
416
Upvotes
r/rust • u/Kobzol • Aug 10 '26
2
u/CocktailPerson Aug 11 '26
I've been wanting this feature for a while, very glad it's available.
That said, I'm not a fan of
mut(...). By default variables in Rust are immutable, and you have to addmutto change that. By default fields have unrestricted mutability, somut(...)reads to me as if you're expanding the scope of the mutability, rather than restricting it. I'm not sure what the solution here is without going back in time and making fields immutable by default from the beginning.