Skip to content

Commit

Permalink
Merge pull request #1141 from dtolnay/forclosure
Browse files Browse the repository at this point in the history
Parse `for<…>` lifetime introducer on closures
  • Loading branch information
dtolnay committed Mar 14, 2022
2 parents 5d1cd93 + c1ef9ed commit fd6f0bf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/expr.rs
Expand Up @@ -1731,6 +1731,12 @@ pub(crate) mod parsing {
|| input.peek(Token![move])
{
expr_closure(input, allow_struct).map(Expr::Closure)
} else if input.peek(Token![for]) && input.peek2(Token![<]) && input.peek3(Lifetime) {
let begin = input.fork();
input.parse::<BoundLifetimes>()?;
expr_closure(input, allow_struct)?;
let verbatim = verbatim::between(begin, input);
Ok(Expr::Verbatim(verbatim))
} else if input.peek(Ident)
|| input.peek(Token![::])
|| input.peek(Token![<])
Expand Down

0 comments on commit fd6f0bf

Please sign in to comment.