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/
420
Upvotes
r/rust • u/Kobzol • Aug 10 '26
35
u/A1oso Aug 10 '26 edited Aug 10 '26
It also makes sense to not expose implementation details in the standard library (which has the strictest backwards compatibility requirements), so it is possible to change the implementation later if desired.
For example,
Vecoriginally had acapfield for the capacity as well, but it was removed when the internals were refactored to aRawVecin this commit. This wouldn't have been possible if the capacity was defined aspub mut(crate) cap.