librustc: replace unreachable! with bug!()
This commit is contained in:
parent
bcdaccfbbe
commit
dfd0e937ac
9 changed files with 21 additions and 21 deletions
|
@ -259,7 +259,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
|
|||
// quick check to see if this variable was
|
||||
// created since the snapshot started or not.
|
||||
let escaping_type = match self.values.get(vid.index as usize).value {
|
||||
Bounded { .. } => unreachable!(),
|
||||
Bounded { .. } => bug!(),
|
||||
Known(ty) => ty,
|
||||
};
|
||||
escaping_types.push(escaping_type);
|
||||
|
|
|
@ -724,12 +724,12 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
|
|||
let fn_body_id = {
|
||||
let fn_expr = match self.tcx().map.find(upvar_id.closure_expr_id) {
|
||||
Some(ast_map::NodeExpr(e)) => e,
|
||||
_ => unreachable!()
|
||||
_ => bug!()
|
||||
};
|
||||
|
||||
match fn_expr.node {
|
||||
hir::ExprClosure(_, _, ref body) => body.id,
|
||||
_ => unreachable!()
|
||||
_ => bug!()
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1453,10 +1453,10 @@ impl<'tcx> cmt_<'tcx> {
|
|||
match inner.cat {
|
||||
Categorization::Deref(ref inner, _, _) => inner.clone(),
|
||||
Categorization::Upvar(..) => inner.clone(),
|
||||
_ => unreachable!()
|
||||
_ => bug!()
|
||||
}
|
||||
}
|
||||
_ => unreachable!()
|
||||
_ => bug!()
|
||||
})
|
||||
}
|
||||
NoteNone => None
|
||||
|
@ -1485,7 +1485,7 @@ impl<'tcx> cmt_<'tcx> {
|
|||
Some(&Categorization::Upvar(ref var)) => {
|
||||
var.to_string()
|
||||
}
|
||||
Some(_) => unreachable!(),
|
||||
Some(_) => bug!(),
|
||||
None => {
|
||||
match pk {
|
||||
Implicit(..) => {
|
||||
|
|
|
@ -385,8 +385,8 @@ impl RegionMaps {
|
|||
}
|
||||
Entry::Vacant(v) => {
|
||||
if self.code_extents.borrow().len() > 0xffffffffusize {
|
||||
unreachable!() // should pass a sess,
|
||||
// but this isn't the only place
|
||||
bug!() // should pass a sess,
|
||||
// but this isn't the only place
|
||||
}
|
||||
let idx = CodeExtent(self.code_extents.borrow().len() as u32);
|
||||
info!("CodeExtent({}) = {:?} [parent={}]", idx.0, e, parent.0);
|
||||
|
@ -601,12 +601,12 @@ impl RegionMaps {
|
|||
scope_a
|
||||
} else {
|
||||
// neither fn encloses the other
|
||||
unreachable!()
|
||||
bug!()
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// root ids are always Misc right now
|
||||
unreachable!()
|
||||
bug!()
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1016,7 +1016,7 @@ fn fmt_const_val<W: Write>(fmt: &mut W, const_val: &ConstVal) -> fmt::Result {
|
|||
Struct(node_id) | Tuple(node_id) | Array(node_id, _) | Repeat(node_id, _) =>
|
||||
write!(fmt, "{}", node_to_string(node_id)),
|
||||
Char(c) => write!(fmt, "{:?}", c),
|
||||
Dummy => unreachable!(),
|
||||
Dummy => bug!(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ macro_rules! options {
|
|||
value, $outputname,
|
||||
key, type_desc))
|
||||
}
|
||||
(None, None) => unreachable!()
|
||||
(None, None) => bug!()
|
||||
}
|
||||
}
|
||||
found = true;
|
||||
|
|
|
@ -201,7 +201,7 @@ pub fn report_overflow_error<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
|
|||
|
||||
err.emit();
|
||||
infcx.tcx.sess.abort_if_errors();
|
||||
unreachable!();
|
||||
bug!();
|
||||
}
|
||||
|
||||
/// Reports that a cycle was detected which led to overflow and halts
|
||||
|
@ -323,7 +323,7 @@ pub fn try_report_overflow_error_type_of_infinite_size<'a, 'tcx>(
|
|||
}
|
||||
err.emit();
|
||||
infcx.tcx.sess.abort_if_errors();
|
||||
unreachable!();
|
||||
bug!();
|
||||
}
|
||||
|
||||
pub fn recursive_type_with_infinite_size_error<'tcx>(tcx: &TyCtxt<'tcx>,
|
||||
|
|
|
@ -1870,7 +1870,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
ty::BoundSized => ok_if(types),
|
||||
|
||||
// Shouldn't be coming through here.
|
||||
ty::BoundSend | ty::BoundSync => unreachable!(),
|
||||
ty::BoundSend | ty::BoundSync => bug!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2660,7 +2660,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
vec![inner_target]));
|
||||
}
|
||||
|
||||
_ => unreachable!()
|
||||
_ => bug!()
|
||||
};
|
||||
|
||||
Ok(VtableBuiltinData { nested: nested })
|
||||
|
|
|
@ -259,7 +259,7 @@ impl<'tcx> Decodable for &'tcx ClosureSubsts<'tcx> {
|
|||
Box::new(closure_substs));
|
||||
match ty.sty {
|
||||
TyClosure(_, ref closure_substs) => Ok(&**closure_substs),
|
||||
_ => unreachable!()
|
||||
_ => bug!()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -467,7 +467,7 @@ impl<'tcx> FnOutput<'tcx> {
|
|||
pub fn unwrap(self) -> Ty<'tcx> {
|
||||
match self {
|
||||
ty::FnConverging(t) => t,
|
||||
ty::FnDiverging => unreachable!()
|
||||
ty::FnDiverging => bug!()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ impl IntTypeExt for attr::IntType {
|
|||
SignedInt(ast::IntTy::Is) => match tcx.sess.target.int_type {
|
||||
ast::IntTy::I32 => ConstInt::Isize(ConstIsize::Is32(0)),
|
||||
ast::IntTy::I64 => ConstInt::Isize(ConstIsize::Is64(0)),
|
||||
_ => unreachable!(),
|
||||
_ => bug!(),
|
||||
},
|
||||
UnsignedInt(ast::UintTy::U8) => ConstInt::U8(0),
|
||||
UnsignedInt(ast::UintTy::U16) => ConstInt::U16(0),
|
||||
|
@ -71,7 +71,7 @@ impl IntTypeExt for attr::IntType {
|
|||
UnsignedInt(ast::UintTy::Us) => match tcx.sess.target.uint_type {
|
||||
ast::UintTy::U32 => ConstInt::Usize(ConstUsize::Us32(0)),
|
||||
ast::UintTy::U64 => ConstInt::Usize(ConstUsize::Us64(0)),
|
||||
_ => unreachable!(),
|
||||
_ => bug!(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
hash!(p.idx);
|
||||
hash!(p.name.as_str());
|
||||
}
|
||||
TyInfer(_) => unreachable!(),
|
||||
TyInfer(_) => bug!(),
|
||||
TyError => byte!(21),
|
||||
TyClosure(d, _) => {
|
||||
byte!(22);
|
||||
|
|
Loading…
Add table
Reference in a new issue