Closed
Description
<kimundi> If you have a function that takes a reference to a closure the lifetime specifier becomes confusing
<kimundi> fn foo(&|T| -> U), fn foo(&'a |T| -> U) and fn foo(&'a 'a |T| -> U) are all valid, and in the second one you can't tell which one of both the lifetimes is supposed to belong to
<nmatsakis> kimundi: this is parser bug, 'a |T| shouldn't parse
<nmatsakis> it should be |T|:'a
<nmatsakis> the parser may well be wrong
<nmatsakis> maybe got overlooked
<kimundi> well, if I change to that syntax I get compile errors
<kimundi> this works: impl<'a> StringPrefixMatch for 'a |$self_anon| -> bool
<kimundi> this doesn't: impl<'a> StringPrefixMatch for |$self_anon|:'a -> bool
<kimundi> I get a "'static is the only valid region allowed here" error
<nmatsakis> kimundi: I think it's just a parser bug
<nmatsakis> kimundi: yes, I can understand why that would occur
<kimundi> why?
<nmatsakis> kimundi: basically because some cleanup is needed
<nmatsakis> we are interpreting |...|:K with K as a list of bounds , which is correct,
<nmatsakis> but we currently haven't implemented support for arbitrary lifetimes in bounds,
<nmatsakis> which is wrong,
<nmatsakis> and instead we have special case treatment for closures,
<kimundi> Ah, so it only accepts the 'static bound there
<nmatsakis> which kind of fit ok with the old syntax,
<nmatsakis> but in the newer one we really should be just using general lifetimes in bounds
Metadata
Metadata
Assignees
Labels
No labels