about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
diff options
context:
space:
mode:
authorMatthew Jasper <mjjasper1@gmail.com>2019-05-03 22:24:52 +0100
committerMatthew Jasper <mjjasper1@gmail.com>2019-05-21 20:38:17 +0100
commitebd6c7164ee7d8f85a640858f1cad1f56cc11a35 (patch)
tree738f14c3e130e1678442d2b626dcabba18b44439 /src/libsyntax/parse/parser.rs
parent50a0defd5a93523067ef239936cc2e0755220904 (diff)
downloadrust-ebd6c7164ee7d8f85a640858f1cad1f56cc11a35.tar.gz
rust-ebd6c7164ee7d8f85a640858f1cad1f56cc11a35.zip
Dont show variables from desugarings in borrowck errors
Diffstat (limited to 'src/libsyntax/parse/parser.rs')
-rw-r--r--src/libsyntax/parse/parser.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 24d120376de..8083e00f607 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -8423,6 +8423,8 @@ impl<'a> Parser<'a> {
             for (index, input) in decl.inputs.iter_mut().enumerate() {
                 let id = ast::DUMMY_NODE_ID;
                 let span = input.pat.span;
+                let desugared_span = self.sess.source_map()
+                    .mark_span_with_reason(CompilerDesugaringKind::Async, span, None);
 
                 // Construct a name for our temporary argument.
                 let name = format!("__arg{}", index);
@@ -8439,8 +8441,7 @@ impl<'a> Parser<'a> {
                         // this would affect the input to procedural macros, but they can have
                         // their span marked as being the result of a compiler desugaring so
                         // that they aren't linted against.
-                        input.pat.span = self.sess.source_map().mark_span_with_reason(
-                            CompilerDesugaringKind::Async, span, None);
+                        input.pat.span = desugared_span;
 
                         (binding_mode, ident, true)
                     }
@@ -8460,7 +8461,7 @@ impl<'a> Parser<'a> {
                             node: PatKind::Ident(
                                 BindingMode::ByValue(Mutability::Immutable), ident, None,
                             ),
-                            span,
+                            span: desugared_span,
                         }),
                         source: ArgSource::AsyncFn(input.pat.clone()),
                     })
@@ -8473,7 +8474,7 @@ impl<'a> Parser<'a> {
                     pat: P(Pat {
                         id,
                         node: PatKind::Ident(binding_mode, ident, None),
-                        span,
+                        span: desugared_span,
                     }),
                     // We explicitly do not specify the type for this statement. When the user's
                     // argument type is `impl Trait` then this would require the