Skip to content

Commit

Permalink
parser: bug -> span_bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Dec 31, 2019
1 parent 4ae9c1c commit 2e78061
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/librustc_parse/parser/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/librustc_parse/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_parse/parser/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 2e78061

Please sign in to comment.