librustc: replace span_bug calls with span_bug!()
This commit is contained in:
parent
859b5a141c
commit
bcdaccfbbe
@ -583,13 +583,11 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
|
||||
return *l;
|
||||
}
|
||||
}
|
||||
self.tcx.sess.span_bug(expr.span,
|
||||
&format!("no loop scope for id {}", loop_id));
|
||||
span_bug!(expr.span, "no loop scope for id {}", loop_id);
|
||||
}
|
||||
|
||||
r => {
|
||||
self.tcx.sess.span_bug(expr.span,
|
||||
&format!("bad entry `{:?}` in def_map for label", r));
|
||||
span_bug!(expr.span, "bad entry `{:?}` in def_map for label", r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -339,10 +339,10 @@ impl<'cx, 'tcx> ty::fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
|
||||
// Early-bound regions should really have been substituted away before
|
||||
// we get to this point.
|
||||
ty::ReEarlyBound(..) => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
self.span,
|
||||
&format!("Encountered early bound region when generalizing: {:?}",
|
||||
r));
|
||||
"Encountered early bound region when generalizing: {:?}",
|
||||
r);
|
||||
}
|
||||
|
||||
// Always make a fresh region variable for skolemized regions;
|
||||
|
@ -183,11 +183,10 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
infcx.tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("region {:?} is not associated with \
|
||||
any bound region from A!",
|
||||
r0))
|
||||
"region {:?} is not associated with any bound region from A!",
|
||||
r0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -297,7 +296,7 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
|
||||
|
||||
if a_r.is_some() && b_r.is_some() && only_new_vars {
|
||||
// Related to exactly one bound variable from each fn:
|
||||
return rev_lookup(infcx, span, a_map, a_r.unwrap());
|
||||
return rev_lookup(span, a_map, a_r.unwrap());
|
||||
} else if a_r.is_none() && b_r.is_none() {
|
||||
// Not related to bound variables from either fn:
|
||||
assert!(!r0.is_bound());
|
||||
@ -308,8 +307,7 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn rev_lookup(infcx: &InferCtxt,
|
||||
span: Span,
|
||||
fn rev_lookup(span: Span,
|
||||
a_map: &FnvHashMap<ty::BoundRegion, ty::Region>,
|
||||
r: ty::Region) -> ty::Region
|
||||
{
|
||||
@ -318,9 +316,10 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
|
||||
return ty::ReLateBound(ty::DebruijnIndex::new(1), *a_br);
|
||||
}
|
||||
}
|
||||
infcx.tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("could not find original bound region for {:?}", r));
|
||||
"could not find original bound region for {:?}",
|
||||
r);
|
||||
}
|
||||
|
||||
fn fresh_bound_variable(infcx: &InferCtxt, debruijn: ty::DebruijnIndex) -> ty::Region {
|
||||
@ -336,9 +335,10 @@ fn var_ids<'a, 'tcx>(fields: &CombineFields<'a, 'tcx>,
|
||||
.map(|(_, r)| match *r {
|
||||
ty::ReVar(r) => { r }
|
||||
r => {
|
||||
fields.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
fields.trace.origin.span(),
|
||||
&format!("found non-region-vid: {:?}", r));
|
||||
"found non-region-vid: {:?}",
|
||||
r);
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
@ -536,10 +536,10 @@ pub fn drain_fulfillment_cx_or_panic<'a,'tcx,T>(span: Span,
|
||||
match drain_fulfillment_cx(infcx, fulfill_cx, result) {
|
||||
Ok(v) => v,
|
||||
Err(errors) => {
|
||||
infcx.tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("Encountered errors `{:?}` fulfilling during trans",
|
||||
errors));
|
||||
"Encountered errors `{:?}` fulfilling during trans",
|
||||
errors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -497,10 +497,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
(ReLateBound(..), _) |
|
||||
(_, ReEarlyBound(..)) |
|
||||
(_, ReLateBound(..)) => {
|
||||
self.tcx.sess.span_bug(origin.span(),
|
||||
&format!("cannot relate bound region: {:?} <= {:?}",
|
||||
sub,
|
||||
sup));
|
||||
span_bug!(origin.span(),
|
||||
"cannot relate bound region: {:?} <= {:?}",
|
||||
sub,
|
||||
sup);
|
||||
}
|
||||
(_, ReStatic) => {
|
||||
// all regions are subregions of static, so we can ignore this
|
||||
@ -570,9 +570,9 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
pub fn resolve_var(&self, rid: RegionVid) -> ty::Region {
|
||||
match *self.values.borrow() {
|
||||
None => {
|
||||
self.tcx.sess.span_bug((*self.var_origins.borrow())[rid.index as usize].span(),
|
||||
"attempt to resolve region variable before values have \
|
||||
been computed!")
|
||||
span_bug!((*self.var_origins.borrow())[rid.index as usize].span(),
|
||||
"attempt to resolve region variable before values have \
|
||||
been computed!")
|
||||
}
|
||||
Some(ref values) => {
|
||||
let r = lookup(values, rid);
|
||||
@ -745,11 +745,11 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
}
|
||||
|
||||
(ReVar(v_id), _) | (_, ReVar(v_id)) => {
|
||||
self.tcx.sess.span_bug((*self.var_origins.borrow())[v_id.index as usize].span(),
|
||||
&format!("lub_concrete_regions invoked with non-concrete \
|
||||
regions: {:?}, {:?}",
|
||||
a,
|
||||
b));
|
||||
span_bug!((*self.var_origins.borrow())[v_id.index as usize].span(),
|
||||
"lub_concrete_regions invoked with non-concrete \
|
||||
regions: {:?}, {:?}",
|
||||
a,
|
||||
b);
|
||||
}
|
||||
|
||||
(ReFree(ref fr), ReScope(s_id)) |
|
||||
@ -1193,13 +1193,13 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
self.tcx.sess.span_bug((*self.var_origins.borrow())[node_idx.index as usize].span(),
|
||||
&format!("collect_error_for_expanding_node() could not find \
|
||||
error for var {:?}, lower_bounds={:?}, \
|
||||
upper_bounds={:?}",
|
||||
node_idx,
|
||||
lower_bounds,
|
||||
upper_bounds));
|
||||
span_bug!((*self.var_origins.borrow())[node_idx.index as usize].span(),
|
||||
"collect_error_for_expanding_node() could not find \
|
||||
error for var {:?}, lower_bounds={:?}, \
|
||||
upper_bounds={:?}",
|
||||
node_idx,
|
||||
lower_bounds,
|
||||
upper_bounds);
|
||||
}
|
||||
|
||||
fn collect_concrete_regions(&self,
|
||||
|
@ -1275,9 +1275,9 @@ pub fn check_crate(tcx: &TyCtxt, access_levels: &AccessLevels) {
|
||||
// in the iteration code.
|
||||
for (id, v) in tcx.sess.lints.borrow().iter() {
|
||||
for &(lint, span, ref msg) in v {
|
||||
tcx.sess.span_bug(span,
|
||||
&format!("unprocessed lint {} at {}: {}",
|
||||
lint.as_str(), tcx.map.node_to_string(*id), *msg))
|
||||
span_bug!(span,
|
||||
"unprocessed lint {} at {}: {}",
|
||||
lint.as_str(), tcx.map.node_to_string(*id), *msg)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1314,9 +1314,7 @@ pub fn check_ast_crate(sess: &Session, krate: &ast::Crate) {
|
||||
// in the iteration code.
|
||||
for (_, v) in sess.lints.borrow().iter() {
|
||||
for &(lint, span, ref msg) in v {
|
||||
sess.span_bug(span,
|
||||
&format!("unprocessed lint {}: {}",
|
||||
lint.as_str(), *msg))
|
||||
span_bug!(span, "unprocessed lint {}: {}", lint.as_str(), *msg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +67,7 @@ pub fn ast_ty_to_prim_ty<'tcx>(tcx: &TyCtxt<'tcx>, ast_ty: &ast::Ty)
|
||||
if let ast::TyPath(None, ref path) = ast_ty.node {
|
||||
let def = match tcx.def_map.borrow().get(&ast_ty.id) {
|
||||
None => {
|
||||
tcx.sess.span_bug(ast_ty.span,
|
||||
&format!("unbound path {:?}", path))
|
||||
span_bug!(ast_ty.span, "unbound path {:?}", path)
|
||||
}
|
||||
Some(d) => d.full_def()
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
||||
if let ty::TyStruct(def, _) = self.tcx.expr_ty_adjusted(lhs).sty {
|
||||
self.insert_def_id(def.struct_variant().field_named(name).did);
|
||||
} else {
|
||||
self.tcx.sess.span_bug(lhs.span, "named field access on non-struct")
|
||||
span_bug!(lhs.span, "named field access on non-struct")
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
|
||||
let pat_ty = self.tcx.node_id_to_type(lhs.id);
|
||||
let variant = match pat_ty.sty {
|
||||
ty::TyStruct(adt, _) | ty::TyEnum(adt, _) => adt.variant_of_def(def),
|
||||
_ => self.tcx.sess.span_bug(lhs.span, "non-ADT in struct pattern")
|
||||
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
|
||||
};
|
||||
for pat in pats {
|
||||
if let PatKind::Wild = pat.node.pat.node {
|
||||
|
@ -564,9 +564,10 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
OverloadedCallType::from_method_id(self.tcx(), method_id)
|
||||
}
|
||||
None => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
callee.span,
|
||||
&format!("unexpected callee type {}", callee_ty))
|
||||
"unexpected callee type {}",
|
||||
callee_ty)
|
||||
}
|
||||
};
|
||||
match overloaded_call_type {
|
||||
@ -683,7 +684,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
// may not. This will generate an error earlier in typeck,
|
||||
// so we can just ignore it.
|
||||
if !self.tcx().sess.has_errors() {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
with_expr.span,
|
||||
"with expression doesn't evaluate to a struct");
|
||||
}
|
||||
@ -750,9 +751,9 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
|
||||
let (m, r) = match self_ty.sty {
|
||||
ty::TyRef(r, ref m) => (m.mutbl, r),
|
||||
_ => self.tcx().sess.span_bug(expr.span,
|
||||
&format!("bad overloaded deref type {:?}",
|
||||
method_ty))
|
||||
_ => span_bug!(expr.span,
|
||||
"bad overloaded deref type {:?}",
|
||||
method_ty)
|
||||
};
|
||||
let bk = ty::BorrowKind::from_mutbl(m);
|
||||
self.delegate.borrow(expr.id, expr.span, cmt,
|
||||
@ -934,7 +935,6 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
debug!("determine_pat_move_mode cmt_discr={:?} pat={:?}", cmt_discr,
|
||||
pat);
|
||||
return_if_err!(self.mc.cat_pattern(cmt_discr, pat, |_mc, cmt_pat, pat| {
|
||||
let tcx = self.tcx();
|
||||
let def_map = &self.tcx().def_map;
|
||||
if pat_util::pat_is_binding(&def_map.borrow(), pat) {
|
||||
match pat.node {
|
||||
@ -947,7 +947,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
pat.span,
|
||||
"binding pattern not an identifier");
|
||||
}
|
||||
@ -972,8 +972,6 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
let delegate = &mut self.delegate;
|
||||
return_if_err!(mc.cat_pattern(cmt_discr.clone(), pat, |mc, cmt_pat, pat| {
|
||||
if pat_util::pat_is_binding(&def_map.borrow(), pat) {
|
||||
let tcx = typer.tcx;
|
||||
|
||||
debug!("binding cmt_pat={:?} pat={:?} match_mode={:?}",
|
||||
cmt_pat,
|
||||
pat,
|
||||
@ -1007,7 +1005,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
delegate.consume_pat(pat, cmt_pat, mode);
|
||||
}
|
||||
_ => {
|
||||
tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
pat.span,
|
||||
"binding pattern not an identifier");
|
||||
}
|
||||
@ -1117,10 +1115,10 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
|
||||
// reported.
|
||||
|
||||
if !tcx.sess.has_errors() {
|
||||
let msg = format!("Pattern has unexpected def: {:?} and type {:?}",
|
||||
def,
|
||||
cmt_pat.ty);
|
||||
tcx.sess.span_bug(pat.span, &msg[..])
|
||||
span_bug!(pat.span,
|
||||
"Pattern has unexpected def: {:?} and type {:?}",
|
||||
def,
|
||||
cmt_pat.ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
|
||||
let param_env = match self.param_envs.last() {
|
||||
Some(p) => p,
|
||||
None => {
|
||||
self.tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
"transmute encountered outside of any fn");
|
||||
}
|
||||
@ -245,9 +245,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IntrinsicCheckingVisitor<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
self.tcx
|
||||
.sess
|
||||
.span_bug(expr.span, "transmute wasn't a bare fn?!");
|
||||
span_bug!(expr.span, "transmute wasn't a bare fn?!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,13 +325,10 @@ impl<'a, 'tcx> IrMaps<'a, 'tcx> {
|
||||
|
||||
fn variable(&self, node_id: NodeId, span: Span) -> Variable {
|
||||
match self.variable_map.get(&node_id) {
|
||||
Some(&var) => var,
|
||||
None => {
|
||||
self.tcx
|
||||
.sess
|
||||
.span_bug(span, &format!("no variable registered for id {}",
|
||||
node_id));
|
||||
}
|
||||
Some(&var) => var,
|
||||
None => {
|
||||
span_bug!(span, "no variable registered for id {}", node_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -578,10 +575,10 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
// above and the propagation code below; the two sets of
|
||||
// code have to agree about which AST nodes are worth
|
||||
// creating liveness nodes for.
|
||||
self.ir.tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("no live node registered for node {}",
|
||||
node_id));
|
||||
"no live node registered for node {}",
|
||||
node_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -703,15 +700,15 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
// to find with one
|
||||
match self.ir.tcx.def_map.borrow().get(&id).map(|d| d.full_def()) {
|
||||
Some(Def::Label(loop_id)) => loop_id,
|
||||
_ => self.ir.tcx.sess.span_bug(sp, "label on break/loop \
|
||||
doesn't refer to a loop")
|
||||
_ => span_bug!(sp, "label on break/loop \
|
||||
doesn't refer to a loop")
|
||||
}
|
||||
}
|
||||
None => {
|
||||
// Vanilla 'break' or 'loop', so use the enclosing
|
||||
// loop scope
|
||||
if self.loop_scope.is_empty() {
|
||||
self.ir.tcx.sess.span_bug(sp, "break outside loop");
|
||||
span_bug!(sp, "break outside loop");
|
||||
} else {
|
||||
*self.loop_scope.last().unwrap()
|
||||
}
|
||||
@ -967,7 +964,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
let caps = match this.ir.capture_info_map.get(&expr.id) {
|
||||
Some(caps) => caps.clone(),
|
||||
None => {
|
||||
this.ir.tcx.sess.span_bug(expr.span, "no registered caps");
|
||||
span_bug!(expr.span, "no registered caps");
|
||||
}
|
||||
};
|
||||
caps.iter().rev().fold(succ, |succ, cap| {
|
||||
@ -1061,8 +1058,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
|
||||
match self.break_ln.get(&sc) {
|
||||
Some(&b) => b,
|
||||
None => self.ir.tcx.sess.span_bug(expr.span,
|
||||
"break to unknown label")
|
||||
None => span_bug!(expr.span, "break to unknown label")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1075,8 +1071,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
||||
|
||||
match self.cont_ln.get(&sc) {
|
||||
Some(&b) => b,
|
||||
None => self.ir.tcx.sess.span_bug(expr.span,
|
||||
"loop to unknown label")
|
||||
None => span_bug!(expr.span, "loop to unknown label")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,9 +312,9 @@ impl MutabilityCategory {
|
||||
McImmutable
|
||||
}
|
||||
}
|
||||
_ => tcx.sess.span_bug(p.span, "expected identifier pattern")
|
||||
_ => span_bug!(p.span, "expected identifier pattern")
|
||||
},
|
||||
_ => tcx.sess.span_bug(tcx.map.span(id), "expected identifier pattern")
|
||||
_ => span_bug!(tcx.map.span(id), "expected identifier pattern")
|
||||
};
|
||||
debug!("MutabilityCategory::{}(tcx, id={:?}) => {:?}",
|
||||
"from_local", id, ret);
|
||||
@ -559,8 +559,8 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
||||
Def::TyParam(..) |
|
||||
Def::Label(_) | Def::SelfTy(..) |
|
||||
Def::AssociatedTy(..) => {
|
||||
self.tcx().sess.span_bug(span, &format!("Unexpected definition in \
|
||||
memory categorization: {:?}", def));
|
||||
span_bug!(span, "Unexpected definition in \
|
||||
memory categorization: {:?}", def);
|
||||
}
|
||||
|
||||
Def::Static(_, mutbl) => {
|
||||
@ -583,18 +583,19 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
||||
self.cat_upvar(id, span, var_id, fn_node_id, kind)
|
||||
}
|
||||
None => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("No closure kind for {:?}", closure_id));
|
||||
"No closure kind for {:?}",
|
||||
closure_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("Upvar of non-closure {} - {:?}",
|
||||
fn_node_id,
|
||||
ty));
|
||||
"Upvar of non-closure {} - {:?}",
|
||||
fn_node_id,
|
||||
ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -926,7 +927,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
||||
let ptr = if implicit {
|
||||
match ptr {
|
||||
BorrowedPtr(bk, r) => Implicit(bk, r),
|
||||
_ => self.tcx().sess.span_bug(node.span(),
|
||||
_ => span_bug!(node.span(),
|
||||
"Implicit deref of non-borrowed pointer")
|
||||
}
|
||||
} else {
|
||||
@ -1092,8 +1093,8 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
||||
},
|
||||
|
||||
_ => {
|
||||
tcx.sess.span_bug(pat.span,
|
||||
"type of slice pattern is not a slice");
|
||||
span_bug!(pat.span,
|
||||
"type of slice pattern is not a slice");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1261,9 +1262,10 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
pat.span,
|
||||
&format!("enum pattern didn't resolve to enum or struct {:?}", opt_def));
|
||||
"enum pattern didn't resolve to enum or struct {:?}",
|
||||
opt_def);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ fn method_might_be_inlined(tcx: &TyCtxt, sig: &hir::MethodSig,
|
||||
Some(ast_map::NodeItem(item)) =>
|
||||
item_might_be_inlined(&item),
|
||||
Some(..) | None =>
|
||||
tcx.sess.span_bug(impl_item.span, "impl did is not an item")
|
||||
span_bug!(impl_item.span, "impl did is not an item")
|
||||
}
|
||||
} else {
|
||||
tcx.sess.span_bug(impl_item.span, "found a foreign impl as a parent of a local method")
|
||||
span_bug!(impl_item.span, "found a foreign impl as a parent of a local method")
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,8 +94,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ReachableContext<'a, 'tcx> {
|
||||
let def = match self.tcx.def_map.borrow().get(&expr.id) {
|
||||
Some(d) => d.full_def(),
|
||||
None => {
|
||||
self.tcx.sess.span_bug(expr.span,
|
||||
"def ID not in def map?!")
|
||||
span_bug!(expr.span, "def ID not in def map?!")
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -747,9 +747,9 @@ impl<'a> LifetimeContext<'a> {
|
||||
lifetime_ref: &hir::Lifetime,
|
||||
def: DefRegion) {
|
||||
if lifetime_ref.id == ast::DUMMY_NODE_ID {
|
||||
self.sess.span_bug(lifetime_ref.span,
|
||||
"lifetime reference not renumbered, \
|
||||
probably a bug in syntax::fold");
|
||||
span_bug!(lifetime_ref.span,
|
||||
"lifetime reference not renumbered, \
|
||||
probably a bug in syntax::fold");
|
||||
}
|
||||
|
||||
debug!("lifetime_ref={:?} id={:?} resolved to {:?}",
|
||||
|
@ -516,8 +516,8 @@ pub fn check_expr(tcx: &TyCtxt, e: &hir::Expr,
|
||||
span = field.span;
|
||||
match tcx.expr_ty_adjusted(base_e).sty {
|
||||
ty::TyStruct(def, _) => def.struct_variant().field_named(field.node).did,
|
||||
_ => tcx.sess.span_bug(e.span,
|
||||
"stability::check_expr: named field access on non-struct")
|
||||
_ => span_bug!(e.span,
|
||||
"stability::check_expr: named field access on non-struct")
|
||||
}
|
||||
}
|
||||
hir::ExprTupField(ref base_e, ref field) => {
|
||||
@ -525,9 +525,9 @@ pub fn check_expr(tcx: &TyCtxt, e: &hir::Expr,
|
||||
match tcx.expr_ty_adjusted(base_e).sty {
|
||||
ty::TyStruct(def, _) => def.struct_variant().fields[field.node].did,
|
||||
ty::TyTuple(..) => return,
|
||||
_ => tcx.sess.span_bug(e.span,
|
||||
"stability::check_expr: unnamed field access on \
|
||||
something other than a tuple or struct")
|
||||
_ => span_bug!(e.span,
|
||||
"stability::check_expr: unnamed field access on \
|
||||
something other than a tuple or struct")
|
||||
}
|
||||
}
|
||||
hir::ExprStruct(_, ref expr_fields, _) => {
|
||||
@ -551,10 +551,10 @@ pub fn check_expr(tcx: &TyCtxt, e: &hir::Expr,
|
||||
// a bug to have construct one.
|
||||
ty::TyEnum(..) => return,
|
||||
_ => {
|
||||
tcx.sess.span_bug(e.span,
|
||||
&format!("stability::check_expr: struct construction \
|
||||
of non-struct, type {:?}",
|
||||
type_));
|
||||
span_bug!(e.span,
|
||||
"stability::check_expr: struct construction \
|
||||
of non-struct, type {:?}",
|
||||
type_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -268,9 +268,9 @@ pub fn try_report_overflow_error_type_of_infinite_size<'a, 'tcx>(
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
infcx.tcx.sess.span_bug(obligation.cause.span,
|
||||
&format!("Sized cycle involving non-trait-ref: {:?}",
|
||||
obligation.predicate));
|
||||
span_bug!(obligation.cause.span,
|
||||
"Sized cycle involving non-trait-ref: {:?}",
|
||||
obligation.predicate);
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
@ -472,9 +472,10 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
|
||||
// ambiguity; otherwise, they always
|
||||
// degenerate into other obligations
|
||||
// (which may fail).
|
||||
infcx.tcx.sess.span_bug(
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
&format!("WF predicate not satisfied for {:?}", ty));
|
||||
"WF predicate not satisfied for {:?}",
|
||||
ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -858,10 +858,10 @@ fn assemble_candidates_from_object_type<'cx,'tcx>(
|
||||
let data = match object_ty.sty {
|
||||
ty::TyTrait(ref data) => data,
|
||||
_ => {
|
||||
selcx.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
&format!("assemble_candidates_from_object_type called with non-object: {:?}",
|
||||
object_ty));
|
||||
"assemble_candidates_from_object_type called with non-object: {:?}",
|
||||
object_ty);
|
||||
}
|
||||
};
|
||||
let projection_bounds = data.projection_bounds_with_self_ty(selcx.tcx(), object_ty);
|
||||
@ -951,10 +951,10 @@ fn assemble_candidates_from_impls<'cx,'tcx>(
|
||||
super::VtableDefaultImpl(..) |
|
||||
super::VtableBuiltin(..) => {
|
||||
// These traits have no associated types.
|
||||
selcx.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
&format!("Cannot project an associated type from `{:?}`",
|
||||
vtable));
|
||||
"Cannot project an associated type from `{:?}`",
|
||||
vtable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1084,12 +1084,12 @@ fn confirm_param_env_candidate<'cx,'tcx>(
|
||||
projection.projection_ty.trait_ref.clone()) {
|
||||
Ok(()) => { }
|
||||
Err(e) => {
|
||||
selcx.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
&format!("Failed to unify `{:?}` and `{:?}` in projection: {}",
|
||||
obligation,
|
||||
projection,
|
||||
e));
|
||||
"Failed to unify `{:?}` and `{:?}` in projection: {}",
|
||||
obligation,
|
||||
projection,
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1124,8 +1124,9 @@ fn confirm_impl_candidate<'cx,'tcx>(
|
||||
(ty.subst(tcx, substs), nested)
|
||||
}
|
||||
None => {
|
||||
tcx.sess.span_bug(obligation.cause.span,
|
||||
&format!("No associated type for {:?}", trait_ref));
|
||||
span_bug!(obligation.cause.span,
|
||||
"No associated type for {:?}",
|
||||
trait_ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1088,7 +1088,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let trait_def_id = match obligation.predicate.0.trait_ref.self_ty().sty {
|
||||
ty::TyProjection(ref data) => data.trait_ref.def_id,
|
||||
ty::TyInfer(ty::TyVar(_)) => {
|
||||
self.tcx().sess.span_bug(obligation.cause.span,
|
||||
span_bug!(obligation.cause.span,
|
||||
"Self=_ should have been handled by assemble_candidates");
|
||||
}
|
||||
_ => { return; }
|
||||
@ -1125,11 +1125,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
let projection_trait_ref = match skol_trait_predicate.trait_ref.self_ty().sty {
|
||||
ty::TyProjection(ref data) => &data.trait_ref,
|
||||
_ => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
&format!("match_projection_obligation_against_bounds_from_trait() called \
|
||||
but self-ty not a projection: {:?}",
|
||||
skol_trait_predicate.trait_ref.self_ty()));
|
||||
"match_projection_obligation_against_bounds_from_trait() called \
|
||||
but self-ty not a projection: {:?}",
|
||||
skol_trait_predicate.trait_ref.self_ty());
|
||||
}
|
||||
};
|
||||
debug!("match_projection_obligation_against_bounds_from_trait: \
|
||||
@ -2150,10 +2150,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
match self.builtin_bound(bound, obligation)? {
|
||||
If(nested) => Ok(self.vtable_builtin_data(obligation, bound, nested)),
|
||||
AmbiguousBuiltin | ParameterBuiltin => {
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
obligation.cause.span,
|
||||
&format!("builtin bound for {:?} was ambig",
|
||||
obligation));
|
||||
"builtin bound for {:?} was ambig",
|
||||
obligation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2353,8 +2353,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
data.principal_trait_ref_with_self_ty(self.tcx(), self_ty)
|
||||
}
|
||||
_ => {
|
||||
self.tcx().sess.span_bug(obligation.cause.span,
|
||||
"object candidate with non-object");
|
||||
span_bug!(obligation.cause.span,
|
||||
"object candidate with non-object");
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -234,12 +234,11 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
match adjusted_ty.builtin_deref(true, NoPreference) {
|
||||
Some(mt) => mt.ty,
|
||||
None => {
|
||||
cx.sess.span_bug(
|
||||
span_bug!(
|
||||
expr_span,
|
||||
&format!("the {}th autoderef failed: {}",
|
||||
autoderef,
|
||||
adjusted_ty)
|
||||
);
|
||||
"the {}th autoderef failed: {}",
|
||||
autoderef,
|
||||
adjusted_ty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1339,10 +1339,10 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
|
||||
cx.region_maps.item_extent(id))
|
||||
}
|
||||
_ => {
|
||||
cx.sess.span_bug(item.span,
|
||||
"ParameterEnvironment::for_item():
|
||||
can't create a parameter \
|
||||
environment for this kind of item")
|
||||
span_bug!(item.span,
|
||||
"ParameterEnvironment::for_item():
|
||||
can't create a parameter \
|
||||
environment for this kind of item")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2003,8 +2003,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
match self.def_map.borrow().get(&expr.id) {
|
||||
Some(def) => def.full_def(),
|
||||
None => {
|
||||
self.sess.span_bug(expr.span, &format!(
|
||||
"no def-map entry for expr {}", expr.id));
|
||||
span_bug!(expr.span, "no def-map entry for expr {}", expr.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2027,8 +2026,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
Some(&def::PathResolution { base_def: Def::Err, .. })=> true,
|
||||
Some(..) => false,
|
||||
None => self.sess.span_bug(expr.span, &format!(
|
||||
"no def for path {}", expr.id))
|
||||
None => span_bug!(expr.span, "no def for path {}", expr.id)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,15 +604,15 @@ impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
|
||||
}
|
||||
None => {
|
||||
let span = self.span.unwrap_or(DUMMY_SP);
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("Region parameter out of range \
|
||||
when substituting in region {} (root type={:?}) \
|
||||
(space={:?}, index={})",
|
||||
data.name,
|
||||
self.root_ty,
|
||||
data.space,
|
||||
data.index));
|
||||
"Region parameter out of range \
|
||||
when substituting in region {} (root type={:?}) \
|
||||
(space={:?}, index={})",
|
||||
data.name,
|
||||
self.root_ty,
|
||||
data.space,
|
||||
data.index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -659,16 +659,16 @@ impl<'a,'tcx> SubstFolder<'a,'tcx> {
|
||||
Some(t) => *t,
|
||||
None => {
|
||||
let span = self.span.unwrap_or(DUMMY_SP);
|
||||
self.tcx().sess.span_bug(
|
||||
span_bug!(
|
||||
span,
|
||||
&format!("Type parameter `{:?}` ({:?}/{:?}/{}) out of range \
|
||||
when substituting (root type={:?}) substs={:?}",
|
||||
p,
|
||||
source_ty,
|
||||
p.space,
|
||||
p.idx,
|
||||
self.root_ty,
|
||||
self.substs));
|
||||
"Type parameter `{:?}` ({:?}/{:?}/{}) out of range \
|
||||
when substituting (root type={:?}) substs={:?}",
|
||||
p,
|
||||
source_ty,
|
||||
p.space,
|
||||
p.idx,
|
||||
self.root_ty,
|
||||
self.substs);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user