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 04:30:55 +0100
committerMazdak Farrokhzad <twingoow@gmail.com>2019-12-31 04:33:34 +0100
commit2e7806146c008742919124bf6ac9a37c3ece51bb (patch)
treec9b3765618fe79645fafcd4411ce47c3d8c3e727 /src/librustc_parse/parser
parent4ae9c1c3ecbba91d39e74ca97cac349b2fe6dcc3 (diff)
downloadrust-2e7806146c008742919124bf6ac9a37c3ece51bb.tar.gz
rust-2e7806146c008742919124bf6ac9a37c3ece51bb.zip
parser: bug -> span_bug
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs4
-rw-r--r--src/librustc_parse/parser/expr.rs2
-rw-r--r--src/librustc_parse/parser/mod.rs3
-rw-r--r--src/librustc_parse/parser/ty.rs4
4 files changed, 6 insertions, 7 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index 778f24fad6d..05754357bc8 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -165,10 +165,6 @@ impl<'a> Parser<'a> {
         err.span_err(sp, self.diagnostic())
     }
 
-    pub(super) fn bug(&self, m: &str) -> ! {
-        self.sess.span_diagnostic.span_bug(self.token.span, 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 9a4bef37768..ab7c156e370 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -283,7 +283,7 @@ impl<'a> Parser<'a> {
                     self.mk_expr(span, aopexpr, AttrVec::new())
                 }
                 AssocOp::As | AssocOp::Colon | AssocOp::DotDot | AssocOp::DotDotEq => {
-                    self.bug("AssocOp should have been handled by special case")
+                    self.span_bug(span, "AssocOp should have been handled by special case")
                 }
             };
 
diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs
index 322c8dda647..ec6468f4f0a 100644
--- a/src/librustc_parse/parser/mod.rs
+++ b/src/librustc_parse/parser/mod.rs
@@ -884,7 +884,8 @@ impl<'a> Parser<'a> {
     pub fn bump(&mut self) {
         if self.prev_token_kind == PrevTokenKind::Eof {
             // Bumping after EOF is a bad sign, usually an infinite loop.
-            self.bug("attempted to bump the parser past EOF (may be stuck in a loop)");
+            let msg = "attempted to bump the parser past EOF (may be stuck in a loop)";
+            self.span_bug(self.token.span, msg);
         }
 
         self.prev_span = self.meta_var_span.take().unwrap_or(self.token.span);
diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs
index 049c077c3ce..4f7bcf01e1b 100644
--- a/src/librustc_parse/parser/ty.rs
+++ b/src/librustc_parse/parser/ty.rs
@@ -175,7 +175,9 @@ impl<'a> Parser<'a> {
                 {
                     let path = match bounds.remove(0) {
                         GenericBound::Trait(pt, ..) => pt.trait_ref.path,
-                        GenericBound::Outlives(..) => self.bug("unexpected lifetime bound"),
+                        GenericBound::Outlives(..) => {
+                            self.span_bug(ty.span, "unexpected lifetime bound")
+                        }
                     };
                     self.parse_remaining_bounds(Vec::new(), path, lo, true)
                 }