You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Confusing error for missing lifetime on a closure written as <'a> |...| #14105
The type parameter should be a self-contained type, I'm not sure why it's asking for a lifetime specifier.
New description
The error message above seems to be contradictory, since the <'a> thing is a lifetime itself, however, the problem is the environment of the closure needs a lifetime, which is written like ||:'a. It would be nice for the error message to guide people towards the correct thing.
changed the title [-]missing lifetime specifier when none is needed[/-][+]Confusing error for missing lifetime on a closure written as `<'a> |...|`[/+]on May 11, 2014
Activity
huonw commentedon May 11, 2014
The
<'a>is the lifetimes of any parameters, the lifetime of the environment is specified by||:'a.I'll co-opt this issue for improving the error message, since it's very confusing.
[-]missing lifetime specifier when none is needed[/-][+]Confusing error for missing lifetime on a closure written as `<'a> |...|`[/+]alexcrichton commentedon May 11, 2014
Oops, good point, thanks!
alexcrichton commentedon Feb 2, 2015
Now that closures look a lot more like traits I think that this has basically solved itself.
Include generic arguments when suggesting a closure η-reduction (rust…