By Manishearth
Yes, you’re correct. You need this syntax when the borrow checker forces you to add this dependency, i.e. when you’re stuffing one reference inside another, or swapping references, or whatever.
This is why elision is so awesome, it takes care of almost all the cases where you need a “regular” lifetime specification on a function. When elision doesn’t works usually there is something you need to specify.
The subtyping works for callers; lifetimes get stretched and sqeezed to fit the function signature. But the function body itself won’t compile when you’re doing things like stuffing references into other references unless the lifetimes are right.
Read more here: https://news.ycombinator.com/item?id=10485814
Manishearth comments on "Rust Lifetimes"
No comments:
Post a Comment