diff options
| author | David Wood <david@davidtw.co> | 2019-03-13 17:10:27 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2019-04-21 16:46:32 +0100 |
| commit | 9d7da824d6a691d58d486e22cc789c572e3d0bf0 (patch) | |
| tree | efd08de2dcfbfbf790fd4f3beb989c7d7eba7da7 /src/libsyntax/parse | |
| parent | 92e72df2c1402d3d8fceac81e650b633c555a523 (diff) | |
| download | rust-9d7da824d6a691d58d486e22cc789c572e3d0bf0.tar.gz rust-9d7da824d6a691d58d486e22cc789c572e3d0bf0.zip | |
Introduce `ArgSource` for diagnostics.
This commit introduces an `ArgSource` enum that is lowered into the HIR so that diagnostics can correctly refer to the argument pattern's original name rather than the generated pattern.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 172d5c38c77..d7330ff55ad 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1,7 +1,7 @@ use crate::ast::{AngleBracketedArgs, AsyncArgument, ParenthesizedArgs, AttrStyle, BareFnTy}; use crate::ast::{GenericBound, TraitBoundModifier}; use crate::ast::Unsafety; -use crate::ast::{Mod, AnonConst, Arg, Arm, Guard, Attribute, BindingMode, TraitItemKind}; +use crate::ast::{Mod, AnonConst, Arg, ArgSource, Arm, Guard, Attribute, BindingMode, TraitItemKind}; use crate::ast::Block; use crate::ast::{BlockCheckMode, CaptureBy, Movability}; use crate::ast::{Constness, Crate}; @@ -550,7 +550,7 @@ fn dummy_arg(span: Span) -> Arg { span, id: ast::DUMMY_NODE_ID }; - Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID } + Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID, source: ast::ArgSource::Normal } } #[derive(Copy, Clone, Debug)] @@ -2126,7 +2126,7 @@ impl<'a> Parser<'a> { } }; - Ok(Arg { ty, pat, id: ast::DUMMY_NODE_ID }) + Ok(Arg { ty, pat, id: ast::DUMMY_NODE_ID, source: ast::ArgSource::Normal }) } /// Parses a single function argument. @@ -2149,7 +2149,8 @@ impl<'a> Parser<'a> { Ok(Arg { ty: t, pat, - id: ast::DUMMY_NODE_ID + id: ast::DUMMY_NODE_ID, + source: ast::ArgSource::Normal, }) } @@ -8856,6 +8857,7 @@ impl<'a> Parser<'a> { ), span, }), + source: ArgSource::AsyncFn(input.pat.clone()), }; // Construct a `let <pat> = __argN;` statement to insert at the top of the |
