]> git.lizzy.rs Git - rust.git/commitdiff
parser: bug -> span_bug
authorMazdak Farrokhzad <twingoow@gmail.com>
Tue, 31 Dec 2019 03:30:55 +0000 (04:30 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Tue, 31 Dec 2019 03:33:34 +0000 (04:33 +0100)
src/librustc_parse/parser/diagnostics.rs
src/librustc_parse/parser/expr.rs
src/librustc_parse/parser/mod.rs
src/librustc_parse/parser/ty.rs

index 778f24fad6d4910d3e299a1293eb5694ba823150..05754357bc82210c0dde8e7deb9db4abf1bbd657 100644 (file)
@@ -165,10 +165,6 @@ pub(super) fn span_fatal_err<S: Into<MultiSpan>>(
         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)
     }
index 9a4bef3776865d19185ab92bcd5b007e09da82a1..ab7c156e3706d85fcb30c8badf7380b6720a07be 100644 (file)
@@ -283,7 +283,7 @@ pub(super) fn parse_assoc_expr_with(
                     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")
                 }
             };
 
index 322c8dda647934b8cd83febf0836df7e322ff16a..ec6468f4f0a329c81e6b50a94e227124b3d0f58a 100644 (file)
@@ -884,7 +884,8 @@ fn parse_paren_comma_seq<T>(
     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);
index 049c077c3cea338abd50624d701bec86f8cebe76..4f7bcf01e1b82ca8906f93defb2f05ae04bea2aa 100644 (file)
@@ -175,7 +175,9 @@ fn parse_ty_tuple_or_parens(&mut self, lo: Span, allow_plus: bool) -> PResult<'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)
                 }