mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
librustc_resolve: use bug!(), span_bug!()
This commit is contained in:
@@ -507,7 +507,7 @@ fn build_reduced_graph_for_external_crate_def(&mut self, parent: Module<'b>, xcd
|
||||
Def::Label(..) |
|
||||
Def::SelfTy(..) |
|
||||
Def::Err => {
|
||||
panic!("didn't expect `{:?}`", def);
|
||||
bug!("didn't expect `{:?}`", def);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-12
@@ -32,6 +32,7 @@
|
||||
#[no_link]
|
||||
extern crate rustc_bitflags;
|
||||
extern crate rustc_front;
|
||||
#[macro_use]
|
||||
extern crate rustc;
|
||||
|
||||
use self::PatternBindingMode::*;
|
||||
@@ -2375,11 +2376,11 @@ fn resolve_pattern(&mut self,
|
||||
// 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 {
|
||||
@@ -2668,7 +2669,7 @@ fn adjust_local_def(&mut self, local_def: LocalDef, span: Span) -> Option<Def> {
|
||||
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 {
|
||||
@@ -3189,7 +3190,7 @@ fn resolve_expr(&mut self, expr: &Expr) {
|
||||
})
|
||||
}
|
||||
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!")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3346,7 +3347,7 @@ fn lookup_candidates<FilterFn>(&mut self,
|
||||
paths.push(segm);
|
||||
paths
|
||||
}
|
||||
_ => unreachable!(),
|
||||
_ => bug!(),
|
||||
};
|
||||
|
||||
if !in_module_is_extern || name_binding.is_public() {
|
||||
@@ -3368,10 +3369,10 @@ fn record_def(&mut self, node_id: NodeId, resolution: PathResolution) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user