Skip to content

Commit

Permalink
librustc_resolve: use bug!(), span_bug!()
Browse files Browse the repository at this point in the history
  • Loading branch information
ben0x539 committed Mar 31, 2016
1 parent 487219c commit d05f726
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/librustc_resolve/build_reduced_graph.rs
Expand Up @@ -507,7 +507,7 @@ impl<'b, 'tcx:'b> Resolver<'b, 'tcx> {
Def::Label(..) |
Def::SelfTy(..) |
Def::Err => {
panic!("didn't expect `{:?}`", def);
bug!("didn't expect `{:?}`", def);
}
}
}
Expand Down
25 changes: 13 additions & 12 deletions src/librustc_resolve/lib.rs
Expand Up @@ -32,6 +32,7 @@ extern crate arena;
#[no_link]
extern crate rustc_bitflags;
extern crate rustc_front;
#[macro_use]
extern crate rustc;

use self::PatternBindingMode::*;
Expand Down Expand Up @@ -2375,11 +2376,11 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
// The below shouldn't happen because all
// qualified paths should be in PatKind::QPath.
TypecheckRequired =>
self.session.span_bug(path.span,
"resolve_possibly_assoc_item claimed that a path \
in PatKind::Path or PatKind::TupleStruct \
requires typecheck to resolve, but qualified \
paths should be PatKind::QPath"),
span_bug!(path.span,
"resolve_possibly_assoc_item claimed that a path \
in PatKind::Path or PatKind::TupleStruct \
requires typecheck to resolve, but qualified \
paths should be PatKind::QPath"),
ResolveAttempt(resolution) => resolution,
};
if let Some(path_res) = resolution {
Expand Down Expand Up @@ -2668,7 +2669,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let mut def = local_def.def;
match def {
Def::Upvar(..) => {
self.session.span_bug(span, &format!("unexpected {:?} in bindings", def))
span_bug!(span, "unexpected {:?} in bindings", def)
}
Def::Local(_, node_id) => {
for rib in ribs {
Expand Down Expand Up @@ -3189,7 +3190,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
})
}
Some(_) => {
self.session.span_bug(expr.span, "label wasn't mapped to a label def!")
span_bug!(expr.span, "label wasn't mapped to a label def!")
}
}
}
Expand Down Expand Up @@ -3346,7 +3347,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
paths.push(segm);
paths
}
_ => unreachable!(),
_ => bug!(),
};

if !in_module_is_extern || name_binding.is_public() {
Expand All @@ -3368,10 +3369,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
debug!("(recording def) recording {:?} for {}", resolution, node_id);
if let Some(prev_res) = self.def_map.borrow_mut().insert(node_id, resolution) {
let span = self.ast_map.opt_span(node_id).unwrap_or(codemap::DUMMY_SP);
self.session.span_bug(span,
&format!("path resolved multiple times ({:?} before, {:?} now)",
prev_res,
resolution));
span_bug!(span,
"path resolved multiple times ({:?} before, {:?} now)",
prev_res,
resolution);
}
}

Expand Down

0 comments on commit d05f726

Please sign in to comment.