4 ms·
Ahh. So if I added a second parameter it would require the explicit lifetime? That may be what I was doing before that made me think I needed to be explicit all
by brundolf 6y ago
Ahh. So if I added a second parameter it would require the explicit lifetime? That may be what I was doing before that made me think I needed to be explicit all the time.
- jen20 6y agoYes - if there are two references as parameters, there is no way for the compiler to decide which the output reference may be borrowed from - and so which lifetime to assign the output, so it must be explicitly indicated by the programmer. There are a few a few example cases in the doc linked about that walk through the conditions it's necessary to add explicit lifetime annotation.