Skip to content

Commit 2e78061

Browse files
committed
parser: bug -> span_bug
1 parent 4ae9c1c commit 2e78061

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

src/librustc_parse/parser/diagnostics.rs

-4
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ impl<'a> Parser<'a> {
165165
err.span_err(sp, self.diagnostic())
166166
}
167167

168-
pub(super) fn bug(&self, m: &str) -> ! {
169-
self.sess.span_diagnostic.span_bug(self.token.span, m)
170-
}
171-
172168
pub fn struct_span_err<S: Into<MultiSpan>>(&self, sp: S, m: &str) -> DiagnosticBuilder<'a> {
173169
self.sess.span_diagnostic.struct_span_err(sp, m)
174170
}

src/librustc_parse/parser/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ impl<'a> Parser<'a> {
283283
self.mk_expr(span, aopexpr, AttrVec::new())
284284
}
285285
AssocOp::As | AssocOp::Colon | AssocOp::DotDot | AssocOp::DotDotEq => {
286-
self.bug("AssocOp should have been handled by special case")
286+
self.span_bug(span, "AssocOp should have been handled by special case")
287287
}
288288
};
289289

src/librustc_parse/parser/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,8 @@ impl<'a> Parser<'a> {
884884
pub fn bump(&mut self) {
885885
if self.prev_token_kind == PrevTokenKind::Eof {
886886
// Bumping after EOF is a bad sign, usually an infinite loop.
887-
self.bug("attempted to bump the parser past EOF (may be stuck in a loop)");
887+
let msg = "attempted to bump the parser past EOF (may be stuck in a loop)";
888+
self.span_bug(self.token.span, msg);
888889
}
889890

890891
self.prev_span = self.meta_var_span.take().unwrap_or(self.token.span);

src/librustc_parse/parser/ty.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ impl<'a> Parser<'a> {
175175
{
176176
let path = match bounds.remove(0) {
177177
GenericBound::Trait(pt, ..) => pt.trait_ref.path,
178-
GenericBound::Outlives(..) => self.bug("unexpected lifetime bound"),
178+
GenericBound::Outlives(..) => {
179+
self.span_bug(ty.span, "unexpected lifetime bound")
180+
}
179181
};
180182
self.parse_remaining_bounds(Vec::new(), path, lo, true)
181183
}

0 commit comments

Comments
 (0)