Practical suggestions for fixing lifetime errors

The first thing I do with a lifetime problem on an unfamiliar codebase is to flip that lint over to deny, or at least warn, so I can see where the borrows are without having to track down all the types manually. In this particular case, it took me straight to next. At that point it was experience that led me to think "this should almost surely be 'a not '_ (elided)", and indeed just trying that change solved things.

It's nowhere near always that smooth, and so doesn't make the best "how did I solve this" example. This one from earlier today was more involved, but it would take awhile to explore everything. Giving elided lifetimes distinct names is another practical point of advice though, sometimes it improves errors or at least makes them easier to follow than "'_1 would have to outlive '_3". The dead-end of that post is the &'a mut self anti-pattern from above.

If I find some time I'll write up a list of general lifetime things to learn.