Suffice it to say I disagree that a small adjustment is all it usually takes to fix the issue. The core problem is that rust lifetimes are immune to encapsulation. Once a struct exposes a lifetime param, any structs that contain it will also be infected with that param. There’s no way (other than something like rental) to just encapsulate such a relationship as an implementation detail and wrap it in an opaque object that the user doesn’t need to worry about.
The cleanest way out of this situation is to just not use lifetime params in lieu of something like Rc or Arc. This is fine if you control the full vertical stack of your app, but that’s not necessarily true. That thread I just linked above gives an example of someone willing to fork their dependency to resolve this issue. This talk at RustFest Zürich also makes a solid case for not using lifetimes when your objects are “long lived”. I completely agree with his conclusion, but the problem is there’s no way to clearly decide if a type is truly “long lived” or not.
The library author has to guess what scenarios their crate is likely to be used in and how long people are likely to hold onto the structs, but it’s just that, a guess. If i want to play it safe and allow my library to be fully general I have to use Rc/Arc, since using those don’t preclude any particular use case, whereas using a lifetime relationship does. Even in cases where a lifetime relationship seems clearly the correct choice, it still prevents encapsulation.
I don’t think it’s any kind of anti-pattern to want to encapsulate an ownership relationship, and making this possible will allow crate authors to use lifetimes in cases where they seem natural, without concern for what impact that will have on downstream’s ability to build abstractions. Rental is the best I could manage with the current language, but it’s still painfully awkward and unergonomic enough that forking dependencies still feels like a better choice in some cases.