diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-07 00:59:56 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-23 13:45:13 +0100 |
| commit | 9c6bbf125277cf8e9b8374bfbf95f2bc12456f23 (patch) | |
| tree | 31a8d33ec9f5ba7c0ec0099ef0e0d763571c56c4 /src/librustc_parse/parser | |
| parent | ff5762b78a739eb7f1d6f938ca98ca32262de19f (diff) | |
| download | rust-9c6bbf125277cf8e9b8374bfbf95f2bc12456f23.tar.gz rust-9c6bbf125277cf8e9b8374bfbf95f2bc12456f23.zip | |
extract error_unexpected_after_dot and de-fatalize
Diffstat (limited to 'src/librustc_parse/parser')
| -rw-r--r-- | src/librustc_parse/parser/expr.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 64154aa9074..585ddad5a9e 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -715,11 +715,7 @@ impl<'a> Parser<'a> { err? } } - _ => { - // FIXME Could factor this out into non_fatal_unexpected or something. - let actual = self.this_token_to_string(); - self.span_err(self.token.span, &format!("unexpected token: `{}`", actual)); - } + _ => self.error_unexpected_after_dot(), } continue; } @@ -735,6 +731,12 @@ impl<'a> Parser<'a> { return Ok(e); } + fn error_unexpected_after_dot(&self) { + // FIXME Could factor this out into non_fatal_unexpected or something. + let actual = self.this_token_to_string(); + self.struct_span_err(self.token.span, &format!("unexpected token: `{}`", actual)).emit(); + } + fn recover_field_access_by_float_lit( &mut self, lo: Span, |
