Skip to content

Commit cc8159b

Browse files
committed
librustc_lint: use bug!(), span_bug!()
1 parent 065dcd0 commit cc8159b

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/librustc_lint/bad_style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub enum MethodLateContext {
3030
pub fn method_context(cx: &LateContext, id: ast::NodeId, span: Span) -> MethodLateContext {
3131
let def_id = cx.tcx.map.local_def_id(id);
3232
match cx.tcx.impl_or_trait_items.borrow().get(&def_id) {
33-
None => cx.sess().span_bug(span, "missing method descriptor?!"),
33+
None => span_bug!(span, "missing method descriptor?!"),
3434
Some(item) => match item.container() {
3535
ty::TraitContainer(..) => MethodLateContext::TraitDefaultImpl,
3636
ty::ImplContainer(cid) => {

src/librustc_lint/types.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ impl LateLintPass for TypeLimits {
181181
return;
182182
}
183183
}
184-
_ => panic!()
184+
_ => bug!()
185185
};
186186
},
187187
ty::TyUint(t) => {
@@ -195,7 +195,7 @@ impl LateLintPass for TypeLimits {
195195
// _v is u8, within range by definition
196196
ast::LitKind::Byte(_v) => return,
197197
ast::LitKind::Int(v, _) => v,
198-
_ => panic!()
198+
_ => bug!()
199199
};
200200
if lit_val < min || lit_val > max {
201201
cx.span_lint(OVERFLOWING_LITERALS, e.span,
@@ -212,7 +212,7 @@ impl LateLintPass for TypeLimits {
212212
Err(_) => return
213213
}
214214
}
215-
_ => panic!()
215+
_ => bug!()
216216
};
217217
if lit_val < min || lit_val > max {
218218
cx.span_lint(OVERFLOWING_LITERALS, e.span,
@@ -233,7 +233,7 @@ impl LateLintPass for TypeLimits {
233233
hir::BiGt => v >= min && v < max,
234234
hir::BiGe => v > min && v <= max,
235235
hir::BiEq | hir::BiNe => v >= min && v <= max,
236-
_ => panic!()
236+
_ => bug!()
237237
}
238238
}
239239

@@ -319,7 +319,7 @@ impl LateLintPass for TypeLimits {
319319
ast::LitKind::Int(v, ast::LitIntType::Unsuffixed) => v as i64,
320320
_ => return true
321321
},
322-
_ => panic!()
322+
_ => bug!()
323323
};
324324
is_valid(norm_binop, lit_val, min, max)
325325
}
@@ -330,7 +330,7 @@ impl LateLintPass for TypeLimits {
330330
ast::LitKind::Int(v, _) => v,
331331
_ => return true
332332
},
333-
_ => panic!()
333+
_ => bug!()
334334
};
335335
is_valid(norm_binop, lit_val, min, max)
336336
}
@@ -589,7 +589,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
589589
ty::TyParam(..) | ty::TyInfer(..) | ty::TyError |
590590
ty::TyClosure(..) | ty::TyProjection(..) |
591591
ty::TyFnDef(..) => {
592-
panic!("Unexpected type in foreign function")
592+
bug!("Unexpected type in foreign function")
593593
}
594594
}
595595
}

0 commit comments

Comments
 (0)