I don’t like the idea of separating the lifetime-identifier marker, the single-quote, from the lifetime identifier. Permitting arbitrary whitespace and comments between the '
marker and the following alphanumeric string seems like an unnecessary footgun.
It seems preferable to include the marker '
as the first character of a lifetime ident, similar to inclusion of a leading underscore in some non-lifetime idents. That unification permits both lifetime and non-lifetime idents to be in a common hash table or hash map, or share match arms, yet still be distinguishable by inspection of the first character, just as idents with a leading underscore are distinguishable from ones without a leading underscore.
Such identifier unification can lead to unintended pattern matching, as in your example in the prior post. If the formal parameter also begins with a '
that clearly mandates a lifetime ident for the match. In the more common scenario where the formal parameter does not specify a lifetime ident, both types of idents match and any error needs to be detected and reported via the post-match processing.
As I wrote initially, this may be an ignorant suggestion; it’s applicability depends on what happens when a lifetime ident is passed where a non-lifetime parameter is expected.