Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librustc: Add bug!(), bug_span!() macros as unified entry points for internal compiler errors #32562

Merged
merged 19 commits into from
Apr 2, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
librustc_lint: use bug!(), span_bug!()
  • Loading branch information
ben0x539 committed Mar 31, 2016
commit cc8159b0ed63eb29254528fe9f078e3cec087b72
2 changes: 1 addition & 1 deletion src/librustc_lint/bad_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub enum MethodLateContext {
pub fn method_context(cx: &LateContext, id: ast::NodeId, span: Span) -> MethodLateContext {
let def_id = cx.tcx.map.local_def_id(id);
match cx.tcx.impl_or_trait_items.borrow().get(&def_id) {
None => cx.sess().span_bug(span, "missing method descriptor?!"),
None => span_bug!(span, "missing method descriptor?!"),
Some(item) => match item.container() {
ty::TraitContainer(..) => MethodLateContext::TraitDefaultImpl,
ty::ImplContainer(cid) => {
Expand Down
14 changes: 7 additions & 7 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl LateLintPass for TypeLimits {
return;
}
}
_ => panic!()
_ => bug!()
};
},
ty::TyUint(t) => {
Expand All @@ -195,7 +195,7 @@ impl LateLintPass for TypeLimits {
// _v is u8, within range by definition
ast::LitKind::Byte(_v) => return,
ast::LitKind::Int(v, _) => v,
_ => panic!()
_ => bug!()
};
if lit_val < min || lit_val > max {
cx.span_lint(OVERFLOWING_LITERALS, e.span,
Expand All @@ -212,7 +212,7 @@ impl LateLintPass for TypeLimits {
Err(_) => return
}
}
_ => panic!()
_ => bug!()
};
if lit_val < min || lit_val > max {
cx.span_lint(OVERFLOWING_LITERALS, e.span,
Expand All @@ -233,7 +233,7 @@ impl LateLintPass for TypeLimits {
hir::BiGt => v >= min && v < max,
hir::BiGe => v > min && v <= max,
hir::BiEq | hir::BiNe => v >= min && v <= max,
_ => panic!()
_ => bug!()
}
}

Expand Down Expand Up @@ -319,7 +319,7 @@ impl LateLintPass for TypeLimits {
ast::LitKind::Int(v, ast::LitIntType::Unsuffixed) => v as i64,
_ => return true
},
_ => panic!()
_ => bug!()
};
is_valid(norm_binop, lit_val, min, max)
}
Expand All @@ -330,7 +330,7 @@ impl LateLintPass for TypeLimits {
ast::LitKind::Int(v, _) => v,
_ => return true
},
_ => panic!()
_ => bug!()
};
is_valid(norm_binop, lit_val, min, max)
}
Expand Down Expand Up @@ -589,7 +589,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
ty::TyParam(..) | ty::TyInfer(..) | ty::TyError |
ty::TyClosure(..) | ty::TyProjection(..) |
ty::TyFnDef(..) => {
panic!("Unexpected type in foreign function")
bug!("Unexpected type in foreign function")
}
}
}
Expand Down