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-31 00:20:41 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-31 04:33:34 +0100
commit5a64ba63862906588b0dcd8ea2ed9884ec44f4a8 (patch)
tree0cd9756514dc9433cebbebbdc55d231d93809634 /src/librustc_parse/parser
parentb6fc87c5b9af5d626e2b85d008c7146a29733536 (diff)
downloadrust-5a64ba63862906588b0dcd8ea2ed9884ec44f4a8.tar.gz
rust-5a64ba63862906588b0dcd8ea2ed9884ec44f4a8.zip
parser: span_fatal -> struct_span_err
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs6
-rw-r--r--src/librustc_parse/parser/expr.rs2
-rw-r--r--src/librustc_parse/parser/item.rs4
-rw-r--r--src/librustc_parse/parser/module.rs2
-rw-r--r--src/librustc_parse/parser/pat.rs4
-rw-r--r--src/librustc_parse/parser/stmt.rs2
6 files changed, 8 insertions, 12 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index 2e58b702d92..630087fb7e8 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -158,11 +158,7 @@ crate enum ConsumeClosingDelim {
 
 impl<'a> Parser<'a> {
     pub fn fatal(&self, m: &str) -> DiagnosticBuilder<'a> {
-        self.span_fatal(self.token.span, m)
-    }
-
-    crate fn span_fatal<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
-        self.sess.span_diagnostic.struct_span_fatal(sp, m)
+        self.sess.span_diagnostic.struct_span_fatal(self.token.span, m)
     }
 
     pub(super) fn span_fatal_err<S: Into<MultiSpan>>(
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index f5cefeca339..49ca5abe97f 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -1137,7 +1137,7 @@ impl<'a> Parser<'a> {
     pub(super) fn parse_lit(&mut self) -> PResult<'a, Lit> {
         self.parse_opt_lit().ok_or_else(|| {
             let msg = format!("unexpected token: {}", super::token_descr(&self.token));
-            self.span_fatal(self.token.span, &msg)
+            self.struct_span_err(self.token.span, &msg)
         })
     }
 
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs
index 64482f09ede..d7b242f6101 100644
--- a/src/librustc_parse/parser/item.rs
+++ b/src/librustc_parse/parser/item.rs
@@ -445,9 +445,7 @@ impl<'a> Parser<'a> {
         // FAILURE TO PARSE ITEM
         match visibility.node {
             VisibilityKind::Inherited => {}
-            _ => {
-                return Err(self.span_fatal(self.prev_span, "unmatched visibility `pub`"));
-            }
+            _ => return Err(self.struct_span_err(self.prev_span, "unmatched visibility `pub`")),
         }
 
         if !attributes_allowed && !attrs.is_empty() {
diff --git a/src/librustc_parse/parser/module.rs b/src/librustc_parse/parser/module.rs
index 7f5104d260d..1b7d54a1c1e 100644
--- a/src/librustc_parse/parser/module.rs
+++ b/src/librustc_parse/parser/module.rs
@@ -262,7 +262,7 @@ impl<'a> Parser<'a> {
                 err.push_str(" -> ");
             }
             err.push_str(&path.to_string_lossy());
-            return Err(self.span_fatal(id_sp, &err[..]));
+            return Err(self.struct_span_err(id_sp, &err[..]));
         }
         included_mod_stack.push(path.clone());
         drop(included_mod_stack);
diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs
index 6a98d29675e..4895d5428df 100644
--- a/src/librustc_parse/parser/pat.rs
+++ b/src/librustc_parse/parser/pat.rs
@@ -796,7 +796,9 @@ impl<'a> Parser<'a> {
         // binding mode then we do not end up here, because the lookahead
         // will direct us over to `parse_enum_variant()`.
         if self.token == token::OpenDelim(token::Paren) {
-            return Err(self.span_fatal(self.prev_span, "expected identifier, found enum pattern"));
+            return Err(
+                self.struct_span_err(self.prev_span, "expected identifier, found enum pattern")
+            );
         }
 
         Ok(PatKind::Ident(binding_mode, ident, sub))
diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs
index 1d0897a3cf3..1f72c66ea03 100644
--- a/src/librustc_parse/parser/stmt.rs
+++ b/src/librustc_parse/parser/stmt.rs
@@ -325,7 +325,7 @@ impl<'a> Parser<'a> {
     fn error_block_no_opening_brace<T>(&mut self) -> PResult<'a, T> {
         let sp = self.token.span;
         let tok = super::token_descr(&self.token);
-        let mut e = self.span_fatal(sp, &format!("expected `{{`, found {}", tok));
+        let mut e = self.struct_span_err(sp, &format!("expected `{{`, found {}", tok));
         let do_not_suggest_help = self.token.is_keyword(kw::In) || self.token == token::Colon;
 
         // Check to see if the user has written something like