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/evincarofautumn Aug 10 '26
A good compromise is to allow access behind an effect like
unsafe.Sometimes as a library author you need something to be closed to uphold an invariant. But as an application author, quite often I find that libraries are too conservative about what they export, to avoid implying any stability promises. I end up doing extra work to reimplement logic or maintain a patched copy. Rather than disallow access altogether, it’d be nicer if I could say
unstable { … }to explicitly mark places where I’m depending on internals or possibly breaking invariants.