about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
diff options
context:
space:
mode:
authorDinu Blanovschi <git@dnbln.dev>2023-11-04 19:39:32 +0100
committerDinu Blanovschi <git@dnbln.dev>2023-11-04 19:39:32 +0100
commit8de489918ba83e3b6080f10cd6294434564028fa (patch)
treee59e3cebf93a3ee4af8dde466b636e283230bb6f /compiler/rustc_parse/src
parentf81d6f0cb00b1e314107b81bcb9aa72b9df9f564 (diff)
downloadrust-8de489918ba83e3b6080f10cd6294434564028fa.tar.gz
rust-8de489918ba83e3b6080f10cd6294434564028fa.zip
feat(hir): Store the `Span` of the `move` keyword
Diffstat (limited to 'compiler/rustc_parse/src')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 36125e138b2..2bae5d4ba18 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -2303,13 +2303,16 @@ impl<'a> Parser<'a> {
     /// Parses an optional `move` prefix to a closure-like construct.
     fn parse_capture_clause(&mut self) -> PResult<'a, CaptureBy> {
         if self.eat_keyword(kw::Move) {
+            let move_kw_span = self.prev_token.span;
             // Check for `move async` and recover
             if self.check_keyword(kw::Async) {
                 let move_async_span = self.token.span.with_lo(self.prev_token.span.data().lo);
                 Err(errors::AsyncMoveOrderIncorrect { span: move_async_span }
                     .into_diagnostic(&self.sess.span_diagnostic))
             } else {
-                Ok(CaptureBy::Value)
+                Ok(CaptureBy::Value {
+                    move_kw: move_kw_span,
+                })
             }
         } else {
             Ok(CaptureBy::Ref)