diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2020-10-02 20:27:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-02 20:27:16 +0200 |
| commit | de8d7aa400b1d45317a6dcd8b1497fab1bfe3f11 (patch) | |
| tree | af2f2b6015ed7f1c7d6864fba269ebb1f60e317b /compiler/rustc_parse/src/parser | |
| parent | 14d8ee34655aaa1cb919b9d7e0805737b53c421f (diff) | |
| parent | 7d5a6203ec08ef6f5cf2349ba478f54ca1513989 (diff) | |
| download | rust-de8d7aa400b1d45317a6dcd8b1497fab1bfe3f11.tar.gz rust-de8d7aa400b1d45317a6dcd8b1497fab1bfe3f11.zip | |
Rollup merge of #77444 - estebank:pat-field-label, r=davidtwco
Fix span for incorrect pattern field and add label Address #73750.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/pat.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 2c0133a24dc..5aced9dc37c 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -795,6 +795,7 @@ impl<'a> Parser<'a> { } self.bump(); let (fields, etc) = self.parse_pat_fields().unwrap_or_else(|mut e| { + e.span_label(path.span, "while parsing the fields for this pattern"); e.emit(); self.recover_stmt(); (vec![], true) @@ -844,7 +845,7 @@ impl<'a> Parser<'a> { // check that a comma comes after every field if !ate_comma { - let err = self.struct_span_err(self.prev_token.span, "expected `,`"); + let err = self.struct_span_err(self.token.span, "expected `,`"); if let Some(mut delayed) = delayed_err { delayed.emit(); } |
