I too have never faced a real need to solve this problem until a couple of weeks ago, it was always possible to code around it before.
I think now I’ve hit the case where rental is essential, but I would be delighted to be proven wrong. My case involves Rust -> Js FFI, but the need for rental arises at the Rust side.
So, I have this owned object, file, which stores/ownes a bunch of AST nodes. Then, I have ananlysis object, which stores references to the file. This
'f lifetime is the underling lifetime of the file. Analysis can be thought of as a giant hash map from file’s node to some cached information. Analysis has a bunch of methods to query various bits of information about the file, so, on the Rust side, most of the functions take
&Analysis<'f> argument (
&const because analysis uses interior mutability for caches).
PS: @jpernst, your work on rental is super awesome