about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-30 15:09:42 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-31 04:33:34 +0100
commitb6fc87c5b9af5d626e2b85d008c7146a29733536 (patch)
tree7362dedf9b529e3a04647734c3fd80b209aeb444 /src/librustc_parse/parser
parent2091062bf685ec2a64cafdffb72ae8479ff41890 (diff)
downloadrust-b6fc87c5b9af5d626e2b85d008c7146a29733536.tar.gz
rust-b6fc87c5b9af5d626e2b85d008c7146a29733536.zip
de-fatalize some errors
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs4
-rw-r--r--src/librustc_parse/parser/expr.rs6
-rw-r--r--src/librustc_parse/parser/item.rs2
-rw-r--r--src/librustc_parse/parser/path.rs2
-rw-r--r--src/librustc_parse/parser/stmt.rs3
5 files changed, 9 insertions, 8 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index d091cceb932..2e58b702d92 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -177,10 +177,6 @@ impl<'a> Parser<'a> {
         self.sess.span_diagnostic.span_bug(self.token.span, m)
     }
 
-    pub(super) fn span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) {
-        self.sess.span_diagnostic.span_err(sp, m)
-    }
-
     pub fn struct_span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
         self.sess.span_diagnostic.struct_span_err(sp, m)
     }
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 5566407963a..f5cefeca339 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -822,7 +822,11 @@ impl<'a> Parser<'a> {
         } else {
             // Field access `expr.f`
             if let Some(args) = segment.args {
-                self.span_err(args.span(), "field expressions may not have generic arguments");
+                self.struct_span_err(
+                    args.span(),
+                    "field expressions may not have generic arguments",
+                )
+                .emit();
             }
 
             let span = lo.to(self.prev_span);
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs
index 424483292b6..64482f09ede 100644
--- a/src/librustc_parse/parser/item.rs
+++ b/src/librustc_parse/parser/item.rs
@@ -617,7 +617,7 @@ impl<'a> Parser<'a> {
                     // This notably includes paths passed through `ty` macro fragments (#46438).
                     TyKind::Path(None, path) => path,
                     _ => {
-                        self.span_err(ty_first.span, "expected a trait, found type");
+                        self.struct_span_err(ty_first.span, "expected a trait, found type").emit();
                         err_path(ty_first.span)
                     }
                 };
diff --git a/src/librustc_parse/parser/path.rs b/src/librustc_parse/parser/path.rs
index ef22628a5e0..6f24dfcd027 100644
--- a/src/librustc_parse/parser/path.rs
+++ b/src/librustc_parse/parser/path.rs
@@ -93,7 +93,7 @@ impl<'a> Parser<'a> {
         maybe_whole!(self, NtPath, |path| {
             if style == PathStyle::Mod && path.segments.iter().any(|segment| segment.args.is_some())
             {
-                self.diagnostic().span_err(path.span, "unexpected generic arguments in path");
+                self.struct_span_err(path.span, "unexpected generic arguments in path").emit();
             }
             path
         });
diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs
index 8270da6c023..1d0897a3cf3 100644
--- a/src/librustc_parse/parser/stmt.rs
+++ b/src/librustc_parse/parser/stmt.rs
@@ -193,7 +193,8 @@ impl<'a> Parser<'a> {
             if self.prev_token_kind == PrevTokenKind::DocComment {
                 self.span_fatal_err(self.prev_span, Error::UselessDocComment).emit();
             } else if attrs.iter().any(|a| a.style == AttrStyle::Outer) {
-                self.span_err(self.token.span, "expected statement after outer attribute");
+                self.struct_span_err(self.token.span, "expected statement after outer attribute")
+                    .emit();
             }
         }
     }