From 40ae7b5b8e09da657b62bc849b8bcdf99a1cb210 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Thu, 2 Jun 2022 20:15:05 +0400 Subject: Parse closure binders This is first step in implementing RFC 3216. - Parse `for<'a>` before closures in ast - Error in lowering - Add `closure_lifetime_binder` feature --- compiler/rustc_ast/src/ast.rs | 27 ++++++++++++++++++++++++++- compiler/rustc_ast/src/mut_visit.rs | 18 +++++++++++++++++- compiler/rustc_ast/src/visit.rs | 25 +++++++++++++++++++------ 3 files changed, 62 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_ast/src') diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index f705d004422..ac2328a5824 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -1390,7 +1390,7 @@ pub enum ExprKind { /// A closure (e.g., `move |a, b, c| a + b + c`). /// /// The final span is the span of the argument block `|...|`. - Closure(CaptureBy, Async, Movability, P, P, Span), + Closure(ClosureBinder, CaptureBy, Async, Movability, P, P, Span), /// A block (`'label: { ... }`). Block(P, Option